lib/generators/blacklight/install_generator.rb in blacklight-6.0.2 vs lib/generators/blacklight/install_generator.rb in blacklight-6.1.0

- old
+ new

@@ -11,49 +11,48 @@ argument :solr_version, type: :string , default: "latest" class_option :devise , type: :boolean, default: false, aliases: "-d", desc: "Use Devise as authentication logic." class_option :jettywrapper, type: :boolean, default: false, desc: "Use jettywrapper to download and control Jetty" class_option :marc , type: :boolean, default: false, aliases: "-m", desc: "Generate MARC-based demo ." + class_option :'skip-assets', type: :boolean, default: false, desc: "Skip generating javascript and css assets into the application" - desc """ - This generator makes the following changes to your application: - 1. Generates blacklight:models - 2. Generates utilities for working with solr - 3. Adds globalid to the Gemfile - 4. Creates a number of public assets, including images, stylesheets, and javascript - 5. Injects behavior into your user application_controller.rb - 6. Adds example configurations for dealing with MARC-like data - 7. Adds Blacklight routes to your ./config/routes.rb + desc <<-EOS + This generator makes the following changes to your application: + 1. Generates blacklight:models + 2. Generates utilities for working with solr + 3. Creates a number of public assets, including images, stylesheets, and javascript + 4. Injects behavior into your user application_controller.rb + 5. Adds example configurations for dealing with MARC-like data + 6. Adds Blacklight routes to your ./config/routes.rb - Thank you for Installing Blacklight. - """ + Thank you for Installing Blacklight. + EOS def add_solr_wrapper - if options[:jettywrapper] - generate 'blacklight:solr4' - elsif solr_version == 'latest' - generate 'blacklight:solr5' - else - generate "blacklight:solr#{solr_version}" - end + generator_options = '--jettywrapper' if options[:jettywrapper] + solr_generator = case + when options[:jettywrapper] + 'blacklight:solr4' + when solr_version == 'latest' + 'blacklight:solr5' + else + "blacklight:solr#{solr_version}" + end + generate solr_generator, generator_options end - def add_globalid_gem - gem "globalid" - end - def bundle_install Bundler.with_clean_env do run "bundle install" end end # Copy all files in templates/public/ directory to public/ # Call external generator in AssetsGenerator, so we can # leave that callable seperately too. def copy_public_assets - generate "blacklight:assets" + generate "blacklight:assets" unless options[:'skip-assets'] end def generate_blacklight_document generate 'blacklight:document', document_name end @@ -85,11 +84,11 @@ end def add_sass_configuration insert_into_file "config/application.rb", :after => "config.assets.enabled = true" do <<EOF - + # Default SASS Configuration, check out https://github.com/rails/sass-rails for details config.assets.compress = !Rails.env.development? EOF end end @@ -110,11 +109,9 @@ generate 'blacklight:marc:install' end end def add_routes - route <<-EOF - mount Blacklight::Engine => '/' - EOF + route "mount Blacklight::Engine => '/'" end end end