require 'rails/generators' module Blacklight class MarcGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) desc """ 1. Adds additional mime types to you application in the file '/config/initializers/mime_types.rb' 2. Creates config/SolrMarc/... with settings for SolrMarc 3. Creates a CatalogController with some some demo fields for MARC-like data 4. Injects MARC-specific behaviors into the SolrDocument """ # Content types used by Marc Document extension, possibly among others. # Registering a unique content type with 'register' (rather than # register_alias) will allow content-negotiation for the format. def add_mime_types puts "Updating Mime Types" insert_into_file "config/initializers/mime_types.rb", :after => "# Be sure to restart your server when you modify this file." do < "include Blacklight::Solr::Document" do < "title_display", :author => "author_display", :language => "language_facet", :format => "format" ) EOF end end end end