lib/spotlight/engine.rb in blacklight-spotlight-3.0.0.alpha.2 vs lib/spotlight/engine.rb in blacklight-spotlight-3.0.0.alpha.3

- old
+ new

@@ -5,11 +5,10 @@ # devise must be required to first to ensure we can override devise and invitable views in spotlight correctly require 'devise' require 'devise_invitable' require 'blacklight' -require 'blacklight/oembed' require 'autoprefixer-rails' require 'friendly_id' require 'tophat' require 'paper_trail' require 'clipboard/rails' @@ -19,11 +18,11 @@ require 'riiif' module Spotlight ## # Spotlight::Engine - # rubocop:disable ClassLength + # rubocop:disable Metrics/ClassLength class Engine < ::Rails::Engine isolate_namespace Spotlight # Breadcrumbs on rails must be required outside of an initializer or it doesn't get loaded. require 'breadcrumbs_on_rails/breadcrumbs' require 'breadcrumbs_on_rails/action_controller' @@ -40,17 +39,17 @@ require 'sir_trevor_rails' require 'openseadragon' require 'sprockets/es6' require 'almond-rails' - config.assets.precompile += %w(spotlight/fallback/*.png) + config.assets.precompile += %w[spotlight/fallback/*.png] - config.autoload_paths += %W( + config.autoload_paths += %W[ #{config.root}/app/builders #{config.root}/app/controllers/concerns #{config.root}/app/models/concerns - ) + ] initializer 'spotlight.initialize' do require 'cancan' require 'bootstrap_form' require 'acts-as-taggable-on' @@ -62,15 +61,15 @@ initializer 'oembed.initialize' do OEmbed::Providers.register_all end initializer 'spotlight.factories', after: 'factory_bot.set_factory_paths' do - FactoryBot.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryBot) + FactoryBot.definition_file_paths << File.expand_path('../../spec/factories', __dir__) if defined?(FactoryBot) end initializer 'spotlight.assets.precompile' do |app| - app.config.assets.precompile += %w(spotlight/default_thumbnail.jpg spotlight/default_browse_thumbnail.jpg) + app.config.assets.precompile += %w[spotlight/default_thumbnail.jpg spotlight/default_browse_thumbnail.jpg] Sprockets::ES6.configuration = { 'modules' => 'amd', 'moduleIds' => true } # When we upgrade to Sprockets 4, we can ditch sprockets-es6 and config AMD # in this way: # https://github.com/rails/sprockets/issues/73#issuecomment-139113466 @@ -91,11 +90,11 @@ config.user_class = '::User' config.catalog_controller_class = '::CatalogController' config.default_blacklight_config = nil - config.exhibit_main_navigation = [:curated_features, :browse, :about] + config.exhibit_main_navigation = %i[curated_features browse about] config.resource_partials = [ 'spotlight/resources/external_resources_form', 'spotlight/resources/upload/form', 'spotlight/resources/csv_upload/form', @@ -112,11 +111,11 @@ # Should Spotlight write to solr? If set to false, Spotlight will not initiate indexing. config.writable_index = true # The allowed file extensions for uploading non-repository items. - config.allowed_upload_extensions = %w(jpg jpeg png) + config.allowed_upload_extensions = %w[jpg jpeg png] # Suffixes for spotlight-created solr fields config.solr_fields = OpenStruct.new config.solr_fields.prefix = '' config.solr_fields.boolean_suffix = '_bsi' @@ -239,19 +238,21 @@ # Default configuration for the browse view Blacklight::Configuration.default_values[:browse] ||= Blacklight::OpenStructWithHashAccess.new(document_actions: []) end # make blacklight configuration play nice with bootstrap_form + # rubocop:disable Lint/SendWithMixinArgument Blacklight::OpenStructWithHashAccess.send(:extend, ActiveModel::Translation) + # rubocop:enable Lint/SendWithMixinArgument config.exhibit_themes = ['default'] config.default_page_content_type = 'SirTrevor' - config.sir_trevor_widgets = %w( + config.sir_trevor_widgets = %w[ Heading Text List Quote Iframe Video Oembed Rule UploadedItems Browse LinkToSearch FeaturedPages SolrDocuments SolrDocumentsCarousel SolrDocumentsEmbed SolrDocumentsFeatures SolrDocumentsGrid SearchResults - ) + ] config.routes = OpenStruct.new config.routes.solr_documents = {} config.exports = {