Class: Pineapple::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/pineapple/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



13
14
15
# File 'lib/generators/pineapple/install_generator.rb', line 13

def self.source_root
  @source_root ||= File.join(File.dirname(__FILE__), 'templates')
end

Instance Method Details

#copy_filesObject



26
27
28
# File 'lib/generators/pineapple/install_generator.rb', line 26

def copy_files
	directory "app"		
end

#setup_dbObject



30
31
32
# File 'lib/generators/pineapple/install_generator.rb', line 30

def setup_db
  generate("model", "pineapple_step name:string body:text")
end

#setup_routesObject

Generator Code. Remember this is just suped-up Thor so methods are executed in order



19
20
21
22
23
24
# File 'lib/generators/pineapple/install_generator.rb', line 19

def setup_routes	
	route('resources :pineapple_steps')
   route('match "/pineapple" => "pineapple#steps", :as => :pineapple_steps_engine')
	route('match "/pineapple.js" => "pineapple#show", :as => :pineapple_engine')
   
end