Class: BlacklightUnapiGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- BlacklightUnapiGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/blacklight_unapi/blacklight_unapi_generator.rb
Instance Method Summary collapse
Instance Method Details
#inject_catalog_controller_extension ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/generators/blacklight_unapi/blacklight_unapi_generator.rb', line 12 def inject_catalog_controller_extension file_path = "app/controllers/#{controller_name.underscore}.rb" if File.exists? file_path inject_into_file file_path, :after => "include Blacklight::Catalog" do "\n include BlacklightUnapi::ControllerExtension\n" end end end |
#inject_unapi_configuration ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/blacklight_unapi/blacklight_unapi_generator.rb', line 21 def inject_unapi_configuration insert_into_file 'config/initializers/blacklight_config.rb', :after => "config[:spell_max] = 5\n" do <<EOF # Add documents to the list of object formats that are supported for all objects. # This parameter is a hash, identical to the Blacklight::Solr::Document#export_formats # output; keys are format short-names that can be exported. Hash includes: # :content-type => mime-content-type config[:unapi] = { 'oai_dc_xml' => { :content_type => 'text/xml' } } EOF end end |