Class: Pineapple::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Pineapple::InstallGenerator
- Defined in:
- lib/generators/pineapple/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #copy_files ⇒ Object
- #setup_db ⇒ Object
-
#setup_routes ⇒ Object
Generator Code.
Class Method Details
.source_root ⇒ Object
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_files ⇒ Object
26 27 28 |
# File 'lib/generators/pineapple/install_generator.rb', line 26 def copy_files directory "app" end |
#setup_db ⇒ Object
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_routes ⇒ Object
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 |