Class: Adhearsion::Generators::AppGenerator

Inherits:
Generator show all
Defined in:
lib/adhearsion/generators/app/app_generator.rb

Constant Summary collapse

BASEDIRS =
%w( config script spec )
EMPTYDIRS =
%w( app/call_controllers lib spec/support spec/call_controllers )

Instance Method Summary collapse

Methods inherited from Generator

base_root, default_source_root, desc, namespace, short_desc, source_root

Instance Method Details

#setup_projectObject


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/adhearsion/generators/app/app_generator.rb', line 12

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