5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/scrapey/template.rb', line 5
def self.generate name, *args
puts "creating new scrapey project: #{name}..."
template = File.expand_path('../../../template', __FILE__)
FileUtils.cp_r template, name
Dir.chdir name
Dir.glob(['*/*.*', '*.*']).grep(/template/).each do |fn|
FileUtils.mv fn, fn.gsub('template', name)
end
buf = File.read "#{name}.iss"
buf.gsub! /Template/, name.tr('_', ' ').gsub(/\w+/){|x| x.capitalize}
buf.gsub! /template/, name
File.open("#{name}.iss", 'w'){|f| f << buf}
end
|