Method: Temp::Project#create
- Defined in:
- lib/temp/project.rb
#create ⇒ Object
Create the project
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/temp/project.rb', line 29 def create if File.file? @template.path FileUtils.cp(@template.path, @path) else FileUtils.mkdir_p(path) (@template.files - @template.tempfile.ignore_files).each do |file| t_file = File.join(@template.path, file) p_file = File.join(@path, file) if File.file? t_file if @template.tempfile.erb_files.include? file renderer = ERB.new(File.read(t_file)) File.open(p_file, 'w') { |f| f.write renderer.result(@template.tempfile.get_binding) } else FileUtils.cp(t_file, p_file) end else Dir.mkdir(p_file) end end end end |