Class: Blacklight::Allmaps::GeoblacklightGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Blacklight::Allmaps::GeoblacklightGenerator
- Defined in:
- lib/generators/blacklight/allmaps/geoblacklight_generator.rb
Instance Method Summary collapse
- #add_configuration ⇒ Object
- #add_gbl_stylesheets ⇒ Object
- #add_gbl_tabbed_viewer ⇒ Object
- #add_geoblacklight ⇒ Object
Instance Method Details
#add_configuration ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/generators/blacklight/allmaps/geoblacklight_generator.rb', line 37 def add_configuration inject_into_file "app/controllers/catalog_controller.rb", after: "config.raw_endpoint.enabled = true" do "\n # Blacklight::Allmaps Viewer config.default_solr_unique_key = \"id\" config.default_georeferenced_field = \"gbl_georeferenced_b\"" end end |
#add_gbl_stylesheets ⇒ Object
18 19 20 21 22 |
# File 'lib/generators/blacklight/allmaps/geoblacklight_generator.rb', line 18 def add_gbl_stylesheets append_to_file "app/assets/stylesheets/application.scss" do "@import 'blacklight/allmaps/base';" end end |
#add_gbl_tabbed_viewer ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/generators/blacklight/allmaps/geoblacklight_generator.rb', line 46 def add_gbl_tabbed_viewer # Use the tabbed viewer inject_into_file "app/controllers/catalog_controller.rb", after: "config.show.partials << \"show_default_viewer_container\"" do "\n # Blacklight::Allmaps Tabbed Viewer config.show.partials << \"show_allmaps_tabbed_viewer_container\"" end # Remove the default viewer gsub_file("app/controllers/catalog_controller.rb", "config.show.partials << \"show_default_viewer_container\"", "#config.show.partials << \"show_default_viewer_container\"") end |
#add_geoblacklight ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/generators/blacklight/allmaps/geoblacklight_generator.rb', line 24 def add_geoblacklight gemfile_path = "Gemfile" # Check if the 'geoblacklight' gem is already included in the Gemfile if File.read(gemfile_path).include?("geoblacklight") say_status("skipped", "geoblacklight gem already included in the Gemfile", :yellow) else append_to_file "Gemfile" do "\ngem \"geoblacklight\", \"~> 4.4\"" end end end |