Class: BlacklightOaiProvider::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- BlacklightOaiProvider::InstallGenerator
- Defined in:
- lib/generators/blacklight_oai_provider/install_generator.rb
Instance Method Summary collapse
- #inject_blacklight_oai_routes ⇒ Object
- #inject_catalog_controller_concern ⇒ Object
- #inject_solr_document_concern ⇒ Object
Instance Method Details
#inject_blacklight_oai_routes ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/generators/blacklight_oai_provider/install_generator.rb', line 27 def inject_blacklight_oai_routes file_path = File.join('config', 'routes.rb') inject_into_file file_path, after: 'Rails.application.routes.draw do' do "\n concern :oai_provider, BlacklightOaiProvider::Routes.new\n" end inject_into_file file_path, after: /resource :catalog,+(.*)do$/ do "\n concerns :oai_provider\n" end end |
#inject_catalog_controller_concern ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/generators/blacklight_oai_provider/install_generator.rb', line 18 def inject_catalog_controller_concern file_path = "app/controllers/#{controller_name.underscore}.rb" if File.exist? file_path inject_into_file file_path, after: "include Blacklight::Catalog" do "\n include BlacklightOaiProvider::Controller\n" end end end |
#inject_solr_document_concern ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/blacklight_oai_provider/install_generator.rb', line 8 def inject_solr_document_concern file_path = "app/models/#{model_name.underscore}.rb" if File.exist? file_path inject_into_file file_path, after: "include Blacklight::Solr::Document" do "\n include BlacklightOaiProvider::SolrDocument\n" end end end |