14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/webhook_handler/cli.rb', line 14
def new(name)
@constant_name = name.tr('-', '_').gsub(/-[_-]*(?![_-]|$)/) { '::' }.gsub(/([_-]+|(::)|^)(.|$)/) { Regexp.last_match(2).to_s + Regexp.last_match(3).upcase }
FileUtils.mkdir_p(name)
puts "Creating app '#{name}'..."
templates = {
'Gemfile.tt' => 'Gemfile',
'Procfile' => 'Procfile',
'app.rb.tt' => 'app.rb',
'config.ru.tt' => 'config.ru'
}
templates.each do |src, dest|
template(File.join('templates', src), File.join(name, dest))
end
end
|