lib/reap/project/scaffold.rb in reap-9.3.0 vs lib/reap/project/scaffold.rb in reap-9.3.1

- old
+ new

@@ -1,5 +1,7 @@ +require 'erb' + module Reap class Project def scaffold(options) @@ -110,11 +112,18 @@ dirs.each do |dname| mkdir_p(dname) unless File.exist?(dname) end files.each do |fname| + next if File.exist?(fname) file = File.join(dir, fname) - cp(file, fname) unless File.exist?(fname) + if File.extname(file) == '.erb' + erb = ERB.new(File.read(file)) + txt = erb.result(metadata.get_binding) + File.open(fname.chomp('.erb'), 'w'){ |f| f << txt } + else + cp(file, fname) + end end # A little extra love. dir = File.join('lib',metadata.name)