Class: Warclight::Install
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Warclight::Install
- Defined in:
- lib/generators/warclight/install_generator.rb
Overview
Warclight install generator
Direct Known Subclasses
Instance Method Summary collapse
- #add_custom_routes ⇒ Object
- #add_warclight_search_behavior ⇒ Object
- #assets ⇒ Object
- #create_blacklight_catalog ⇒ Object
- #include_warclight_solrdocument ⇒ Object
- #install_blacklight_range_limit ⇒ Object
- #modify_blacklight_yml ⇒ Object
- #solr_config ⇒ Object
Instance Method Details
#add_custom_routes ⇒ Object
26 27 28 29 30 |
# File 'lib/generators/warclight/install_generator.rb', line 26 def add_custom_routes inject_into_file 'config/routes.rb', after: "mount Blacklight::Engine => '/'" do "\n mount Warclight::Engine => '/'\n" end end |
#add_warclight_search_behavior ⇒ Object
41 42 43 44 45 |
# File 'lib/generators/warclight/install_generator.rb', line 41 def add_warclight_search_behavior inject_into_file 'app/models/search_builder.rb', after: 'include Blacklight::Solr::SearchBuilderBehavior' do "\n include Warclight::SearchBehavior" end end |
#assets ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/generators/warclight/install_generator.rb', line 32 def assets copy_file 'warclight.scss', 'app/assets/stylesheets/warclight.scss' copy_file 'warclight.js', 'app/assets/javascripts/warclight.js' inject_into_file 'app/assets/javascripts/application.js', after: '//= require blacklight/blacklight' do "\n//= require bootstrap/scrollspy\n" \ "\n//= require bootstrap/tab\n" end end |
#create_blacklight_catalog ⇒ Object
11 12 13 14 |
# File 'lib/generators/warclight/install_generator.rb', line 11 def create_blacklight_catalog remove_file 'app/controllers/catalog_controller.rb' copy_file 'catalog_controller.rb', 'app/controllers/catalog_controller.rb' end |
#include_warclight_solrdocument ⇒ Object
16 17 18 19 20 |
# File 'lib/generators/warclight/install_generator.rb', line 16 def include_warclight_solrdocument inject_into_file 'app/models/solr_document.rb', after: 'include Blacklight::Solr::Document' do "\n include Warclight::SolrDocument" end end |
#install_blacklight_range_limit ⇒ Object
22 23 24 |
# File 'lib/generators/warclight/install_generator.rb', line 22 def install_blacklight_range_limit generate 'blacklight_range_limit:install' end |
#modify_blacklight_yml ⇒ Object
51 52 53 |
# File 'lib/generators/warclight/install_generator.rb', line 51 def modify_blacklight_yml gsub_file 'config/locales/blacklight.en.yml', "application_name: 'Blacklight'", "application_name: 'Warclight'" end |
#solr_config ⇒ Object
47 48 49 |
# File 'lib/generators/warclight/install_generator.rb', line 47 def solr_config directory '../../../../solr', 'solr', force: true end |