Skip to content

Commit

Permalink
Merge pull request #157 from mikkergimenez/mikkergp/allow_custom_temp…
Browse files Browse the repository at this point in the history
…lates_in_control_repo

Add functionality to allow custom templates in control repo, this all…
  • Loading branch information
dylanratcliffe authored Mar 6, 2018
2 parents e11d5c2 + 26b9c3e commit baa6be4
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 baa6be4

Please sign in to comment.