Skip to content

Commit

Permalink
Add functionality to allow custom templates in control repo, this all…
Browse files Browse the repository at this point in the history
…ows a custom spec_helper.rb for different flows
  • Loading branch information
mikkergimenez committed Mar 2, 2018
1 parent f3a09f8 commit ea28302
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/onceover/controlrepo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,12 @@ def self.create_dirs_and_log(dir)
def self.evaluate_template(template_name, bind)
logger.debug "Evaluating template #{template_name}"
template_dir = File.expand_path('../../templates', File.dirname(__FILE__))
template = File.read(File.expand_path("./#{template_name}", template_dir))
if File.file?(File.expand_path("./spec/templates/#{template_name}", @root))
puts "Using Custom #{template_name}"
template = File.read(File.expand_path("./spec/templates/#{template_name}", @root))
else
template = File.read(File.expand_path("./#{template_name}", template_dir))
end
ERB.new(template, nil, '-').result(bind)
end

Expand Down

0 comments on commit ea28302

Please sign in to comment.