class Geoblacklight::Install
Public Instance Methods
add_spatial_search_behavior()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 63 def add_spatial_search_behavior inject_into_file 'app/models/search_builder.rb', after: 'include Blacklight::Solr::SearchBuilderBehavior' do "\n include Geoblacklight::SpatialSearchBehavior" end end
add_unique_key()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 57 def add_unique_key inject_into_file 'app/models/solr_document.rb', after: "# self.unique_key = 'id'" do "\n self.unique_key = Settings.FIELDS.UNIQUE_KEY" end end
bundle_install()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 93 def bundle_install Bundler.with_clean_env do run 'bundle install' end end
create_blacklight_catalog()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 38 def create_blacklight_catalog remove_file 'app/controllers/catalog_controller.rb' copy_file 'catalog_controller.rb', 'app/controllers/catalog_controller.rb' end
create_downloads_directory()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 76 def create_downloads_directory FileUtils.mkdir_p('tmp/cache/downloads') unless File.directory?('tmp/cache/downloads') end
create_image_assets_directory()
click to toggle source
Ensure that assets/images exists
# File lib/generators/geoblacklight/install_generator.rb, line 89 def create_image_assets_directory FileUtils.mkdir_p('app/assets/images') unless File.directory?('app/assets/images') end
disable_turbolinks()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 80 def disable_turbolinks gsub_file('app/assets/javascripts/application.js', %r{\/\/= require turbolinks}, '') end
generate_assets()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 34 def generate_assets generate 'geoblacklight:assets' end
include_geoblacklight_solrdocument()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 51 def include_geoblacklight_solrdocument inject_into_file 'app/models/solr_document.rb', after: 'include Blacklight::Solr::Document' do "\n include Geoblacklight::SolrDocument" end end
inject_disable_jquery_animations()
click to toggle source
Turn off JQuery animations during testing
# File lib/generators/geoblacklight/install_generator.rb, line 70 def inject_disable_jquery_animations inject_into_file 'app/views/layouts/application.html.erb', before: '</head>' do " <%= javascript_tag '$.fx.off = true;' if Rails.env.test? %>\n" end end
inject_geoblacklight_routes()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 14 def inject_geoblacklight_routes routes = <<-"ROUTES" concern :gbl_exportable, Geoblacklight::Routes::Exportable.new resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' do concerns :gbl_exportable end concern :gbl_wms, Geoblacklight::Routes::Wms.new namespace :wms do concerns :gbl_wms end concern :gbl_downloadable, Geoblacklight::Routes::Downloadable.new namespace :download do concerns :gbl_downloadable end resources :download, only: [:show] ROUTES inject_into_file 'config/routes.rb', routes, before: /^end/ end
mount_geoblacklight_engine()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 10 def mount_geoblacklight_engine inject_into_file 'config/routes.rb', "mount Geoblacklight::Engine => 'geoblacklight'\n", before: /^end/ end
rails_config()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 43 def rails_config copy_file 'settings.yml', 'config/settings.yml' end
solr_config()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 47 def solr_config directory '../../../../solr', 'solr' end
update_application_name()
click to toggle source
# File lib/generators/geoblacklight/install_generator.rb, line 84 def update_application_name gsub_file('config/locales/blacklight.en.yml', 'Blacklight', 'GeoBlacklight') end