Class: BlacklightIiifSearch::RoutesGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/blacklight_iiif_search/routes_generator.rb

Instance Method Summary collapse

Instance Method Details

#inject_iiif_search_routesObject

Add BlacklightIiifSearch to the routes



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/blacklight_iiif_search/routes_generator.rb', line 14

def inject_iiif_search_routes
  return if IO.read('config/routes.rb').include?('BlacklightIiifSearch::Routes')

  marker = 'Rails.application.routes.draw do'
  inject_into_file 'config/routes.rb', after: marker do
    "\n\n  concern :iiif_search, BlacklightIiifSearch::Routes.new"
  end
  # for blacklight_range_limit
  bl_routes_marker = /resources :solr_documents[\S\s]*controller: 'catalog' do[\s]*concerns :exportable.*$/
  inject_into_file 'config/routes.rb', after: bl_routes_marker do
    "\n    concerns :iiif_search"
  end
end