28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/vendor/template.rb', line 28
def copy(name, options = {})
file_name = options[:name] || name
target = File.join(File.expand_path(Dir.pwd), file_name)
template = File.join(Vendor.root, "vendor", "templates", name)
if File.exist?(target)
Vendor.ui.error "#{name} already exists at #{target}"
else
Vendor.ui.info "Writing new #{name} to #{target}"
contents = parse(File.read(template), options[:locals] || {})
File.open(target, 'w') { |f| f.write(contents) }
end
end
|