Class: Atrium::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Atrium::InstallGenerator
- Defined in:
- lib/generators/atrium/install/install_generator.rb
Instance Method Summary collapse
- #create_controllers ⇒ Object
- #create_helpers ⇒ Object
- #create_initializer ⇒ Object
- #create_models ⇒ Object
- #create_views ⇒ Object
- #update_controllers ⇒ Object
- #update_routes ⇒ Object
- #update_user_model ⇒ Object
Instance Method Details
#create_controllers ⇒ Object
57 58 59 |
# File 'lib/generators/atrium/install/install_generator.rb', line 57 def create_controllers raw_install('controllers') end |
#create_helpers ⇒ Object
65 66 67 |
# File 'lib/generators/atrium/install/install_generator.rb', line 65 def create_helpers raw_install('helpers') end |
#create_initializer ⇒ Object
4 5 6 7 8 9 |
# File 'lib/generators/atrium/install/install_generator.rb', line 4 def create_initializer template( 'atrium_initializer.rb', 'config/initializers/atrium.rb' ) end |
#create_models ⇒ Object
61 62 63 |
# File 'lib/generators/atrium/install/install_generator.rb', line 61 def create_models raw_install('models') end |
#create_views ⇒ Object
69 70 71 |
# File 'lib/generators/atrium/install/install_generator.rb', line 69 def create_views raw_install('views') end |
#update_controllers ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/generators/atrium/install/install_generator.rb', line 24 def update_controllers inject_into_class( 'app/controllers/application_controller.rb', 'ApplicationController' ) do [ "", " def blacklight_config", " CatalogController.blacklight_config", " end", " helper_method :blacklight_config", " protected :blacklight_config", "" ].join("\n") end end |
#update_routes ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/atrium/install/install_generator.rb', line 11 def update_routes route(%q{mount Atrium::Engine => '/atrium', as: 'atrium'}) route(%q{resources :collections, only: [:show] do get 'browse', on: :member end}) route(%q{resources :exhibits, only: [:show]}) route(%q{resources :descriptions}) route(%q{match 'selected_items/save', to: 'selected_items#save', as: 'save_selected_items', via: :post}) end |
#update_user_model ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/generators/atrium/install/install_generator.rb', line 41 def update_user_model inject_into_file 'app/models/user.rb', :before => "def to_s" do [ "", " has_many :selected_items, :class_name => 'SelectedItem', :dependent => :destroy", "", " def selected_document_ids", " self.selected_items.map{|item|item.document_id}", " end", "", "" ].join("\n") end end |