Skip to content

Commit 7ddfd24

Browse files
committed
Fix "matrixeval init -t ruby" to use correct template
1 parent d94a3a0 commit 7ddfd24

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matrixeval/config/yaml.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ class Config
55
class YAML
66

77
class MissingError < StandardError; end
8+
class MissingTargetGem < StandardError; end
89

910
class << self
1011

1112
def create_for(target_name)
1213
return if File.exist?(path)
14+
require "matrixeval/#{target_name}" unless target_name.nil?
1315

1416
FileUtils.cp(
1517
target(target_name).matrixeval_yml_template_path,
1618
path
1719
)
20+
rescue LoadError
21+
raise MissingTargetGem.new("Missing gem for the target #{target_name}")
1822
end
1923

2024
def path
@@ -38,7 +42,7 @@ def target(target_name)
3842
end
3943

4044
def target_klass(target_name)
41-
Matrixeval.targets[target_name] || Target
45+
Matrixeval.targets[target_name&.to_sym] || Target
4246
end
4347

4448
end

0 commit comments

Comments
 (0)