Class: Arclight::Install
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Arclight::Install
- Defined in:
- lib/generators/arclight/install_generator.rb
Overview
Arclight install generator
Direct Known Subclasses
Instance Method Summary collapse
- #add_arclight_search_behavior ⇒ Object
- #add_custom_routes ⇒ Object
- #add_download_config ⇒ Object
- #add_repository_config ⇒ Object
- #assets ⇒ Object
- #create_blacklight_catalog ⇒ Object
- #include_arclight_solrdocument ⇒ Object
- #install_blacklight_locale_picker ⇒ Object
- #install_blacklight_range_limit ⇒ Object
- #modify_blacklight_yml ⇒ Object
- #run_yarn ⇒ Object
- #solr_config ⇒ Object
Instance Method Details
#add_arclight_search_behavior ⇒ Object
51 52 53 54 55 |
# File 'lib/generators/arclight/install_generator.rb', line 51 def add_arclight_search_behavior inject_into_file 'app/models/search_builder.rb', after: 'include Blacklight::Solr::SearchBuilderBehavior' do "\n include Arclight::SearchBehavior" end end |
#add_custom_routes ⇒ Object
40 41 42 43 44 |
# File 'lib/generators/arclight/install_generator.rb', line 40 def add_custom_routes inject_into_file 'config/routes.rb', after: "mount Blacklight::Engine => '/'" do "\n mount Arclight::Engine => '/'\n" end end |
#add_download_config ⇒ Object
65 66 67 |
# File 'lib/generators/arclight/install_generator.rb', line 65 def add_download_config copy_file 'config/downloads.yml' unless File.exist?('config/downloads.yml') end |
#add_repository_config ⇒ Object
61 62 63 |
# File 'lib/generators/arclight/install_generator.rb', line 61 def add_repository_config copy_file 'config/repositories.yml' unless File.exist?('config/repositories.yml') end |
#assets ⇒ Object
46 47 48 49 |
# File 'lib/generators/arclight/install_generator.rb', line 46 def assets copy_file 'arclight.scss', 'app/assets/stylesheets/arclight.scss' copy_file 'arclight.js', 'app/assets/javascripts/arclight.js' end |
#create_blacklight_catalog ⇒ Object
11 12 13 14 |
# File 'lib/generators/arclight/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_arclight_solrdocument ⇒ Object
16 17 18 19 20 |
# File 'lib/generators/arclight/install_generator.rb', line 16 def include_arclight_solrdocument inject_into_file 'app/models/solr_document.rb', after: 'include Blacklight::Solr::Document' do "\n include Arclight::SolrDocument" end end |
#install_blacklight_locale_picker ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/arclight/install_generator.rb', line 22 def install_blacklight_locale_picker gem 'blacklight-locale_picker' Bundler.with_clean_env do run 'bundle install' end generate 'blacklight:locale_picker:install' inject_into_file 'app/helpers/application_helper.rb', after: 'include Blacklight::LocalePicker::LocaleHelper' do "\n\n def additional_locale_routing_scopes\n [blacklight, arclight_engine]\n end" end end |
#install_blacklight_range_limit ⇒ Object
36 37 38 |
# File 'lib/generators/arclight/install_generator.rb', line 36 def install_blacklight_range_limit generate 'blacklight_range_limit:install' end |
#modify_blacklight_yml ⇒ Object
69 70 71 |
# File 'lib/generators/arclight/install_generator.rb', line 69 def modify_blacklight_yml gsub_file 'config/locales/blacklight.en.yml', "application_name: 'Blacklight'", "application_name: 'Arclight'" end |
#run_yarn ⇒ Object
73 74 75 |
# File 'lib/generators/arclight/install_generator.rb', line 73 def run_yarn run 'yarn add @babel/core @babel/plugin-external-helpers @babel/plugin-transform-modules-umd @babel/preset-env' end |
#solr_config ⇒ Object
57 58 59 |
# File 'lib/generators/arclight/install_generator.rb', line 57 def solr_config directory '../../../../solr', 'solr', force: true end |