class Blacklight::Marc::InstallGenerator
Public Instance Methods
add_marc_extension_to_solrdocument()
click to toggle source
add MARC-specific extensions to the solr document
# File lib/generators/blacklight/marc/install_generator.rb, line 36 def add_marc_extension_to_solrdocument insert_into_file "app/models/solr_document.rb", :after => "include Blacklight::Solr::Document" do <<EOF # The following shows how to setup this blacklight document to display marc documents extension_parameters[:marc_source_field] = :marc_ss extension_parameters[:marc_format_type] = :marcxml use_extension(Blacklight::Marc::DocumentExtension) do |document| document.key?(SolrDocument.extension_parameters[:marc_source_field]) end field_semantics.merge!( :title => "title_ssm", :author => "author_ssm", :language => "language_ssim", :format => "format" ) EOF end end
assets()
click to toggle source
# File lib/generators/blacklight/marc/install_generator.rb, line 18 def assets insert_into_file "app/assets/stylesheets/blacklight.scss", after: "@import 'blacklight/blacklight';" do <<-EOF @import 'blacklight_marc'; EOF end end
create_configuration_files()
click to toggle source
Copy all files in templates/config directory to host config
# File lib/generators/blacklight/marc/install_generator.rb, line 28 def create_configuration_files directory("config/translation_maps") end
create_models()
click to toggle source
# File lib/generators/blacklight/marc/install_generator.rb, line 32 def create_models copy_file "app/models/marc_indexer.rb", "app/models/marc_indexer.rb" end
inject_blacklight_controller_behavior()
click to toggle source
Add MARC behaviors to the catalog controller
# File lib/generators/blacklight/marc/install_generator.rb, line 59 def inject_blacklight_controller_behavior inject_into_file "app/controllers/catalog_controller.rb", after:"include Blacklight::Catalog" do "\n include Blacklight::Marc::Catalog\n" end end
inject_blacklight_marc_routes()
click to toggle source
# File lib/generators/blacklight/marc/install_generator.rb, line 66 def inject_blacklight_marc_routes route <<-EOF concern :marc_viewable, Blacklight::Marc::Routes::MarcViewable.new EOF inject_into_file "config/routes.rb", after: "resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' do" do "\n concerns [:exportable, :marc_viewable]\nINJECT_FLAG" end gsub_file "config/routes.rb", /[\n]INJECT_FLAG\s+concerns \:exportable/,"" end