/
app_generator.rb
34 lines (29 loc) · 1.04 KB
/
app_generator.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# encoding: utf-8
module Adhearsion
module Generators
class AppGenerator < Generator
BASEDIRS = %w( config script spec )
EMPTYDIRS = %w( app/call_controllers lib spec/support spec/call_controllers )
class_option :empty, type: :boolean
def setup_project
self.destination_root = @generator_name
BASEDIRS.each { |dir| directory dir }
EMPTYDIRS.each { |dir| empty_directory dir }
template "Gemfile.erb", "Gemfile"
template "adhearsion.erb", "config/adhearsion.rb"
template "events.erb", "config/events.rb"
template "routes.erb", "config/routes.rb"
copy_file "gitignore", ".gitignore"
copy_file "rspec", ".rspec"
copy_file "Procfile"
copy_file "Rakefile"
copy_file "README.md"
unless options[:empty]
copy_file "simon_game.rb", "app/call_controllers/simon_game.rb"
copy_file "simon_game_spec.rb", "spec/call_controllers/simon_game_spec.rb"
end
chmod "script/ahn", 0755
end
end
end
end