Class: Blacklight::Install
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Blacklight::Install
- Defined in:
- lib/generators/blacklight/install_generator.rb
Instance Method Summary collapse
- #add_default_catalog_route ⇒ Object
- #add_routes ⇒ Object
- #add_solr_wrapper ⇒ Object
- #bundle_install ⇒ Object
-
#copy_public_assets ⇒ Object
Copy all files in templates/public/ directory to public/ Call external generator in AssetsGenerator, so we can leave that callable seperately too.
- #generate_blacklight_document ⇒ Object
- #generate_blacklight_marc_demo ⇒ Object
- #generate_blacklight_models ⇒ Object
- #generate_blacklight_user ⇒ Object
- #generate_controller ⇒ Object
- #generate_search_builder ⇒ Object
- #inject_blacklight_i18n_strings ⇒ Object
Instance Method Details
#add_default_catalog_route ⇒ Object
76 77 78 |
# File 'lib/generators/blacklight/install_generator.rb', line 76 def add_default_catalog_route route("root to: \"#{controller_name}#index\"") end |
#add_routes ⇒ Object
95 96 97 |
# File 'lib/generators/blacklight/install_generator.rb', line 95 def add_routes route "mount Blacklight::Engine => '/'" end |
#add_solr_wrapper ⇒ Object
30 31 32 |
# File 'lib/generators/blacklight/install_generator.rb', line 30 def add_solr_wrapper generate 'blacklight:solr' unless [:'skip-solr'] end |
#bundle_install ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/generators/blacklight/install_generator.rb', line 43 def bundle_install inside destination_root do Bundler.with_unbundled_env do run "bundle install" end end end |
#copy_public_assets ⇒ Object
Copy all files in templates/public/ directory to public/ Call external generator in AssetsGenerator, so we can leave that callable seperately too.
37 38 39 40 41 |
# File 'lib/generators/blacklight/install_generator.rb', line 37 def copy_public_assets = "--bootstrap-version='#{[:'bootstrap-version']}'" if [:'bootstrap-version'] generate "blacklight:assets", unless [:'skip-assets'] end |
#generate_blacklight_document ⇒ Object
51 52 53 |
# File 'lib/generators/blacklight/install_generator.rb', line 51 def generate_blacklight_document generate 'blacklight:document', document_name end |
#generate_blacklight_marc_demo ⇒ Object
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/generators/blacklight/install_generator.rb', line 84 def generate_blacklight_marc_demo return unless [:marc] blacklight_marc = String.new('blacklight-marc') gem blacklight_marc, '~> 8.0' bundle_install generate 'blacklight:marc:install' end |
#generate_blacklight_models ⇒ Object
59 60 61 |
# File 'lib/generators/blacklight/install_generator.rb', line 59 def generate_blacklight_models generate 'blacklight:models' end |
#generate_blacklight_user ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/generators/blacklight/install_generator.rb', line 63 def generate_blacklight_user generator_args = [model_name] if [:devise] generator_args << "--devise #{[:devise]}" end generate 'blacklight:user', generator_args.join(" ") end |
#generate_controller ⇒ Object
72 73 74 |
# File 'lib/generators/blacklight/install_generator.rb', line 72 def generate_controller generate 'blacklight:controller', controller_name end |
#generate_search_builder ⇒ Object
55 56 57 |
# File 'lib/generators/blacklight/install_generator.rb', line 55 def generate_search_builder generate 'blacklight:search_builder', search_builder_name end |
#inject_blacklight_i18n_strings ⇒ Object
80 81 82 |
# File 'lib/generators/blacklight/install_generator.rb', line 80 def inject_blacklight_i18n_strings copy_file "blacklight.en.yml", "config/locales/blacklight.en.yml" end |