Skip to content

Commit

Permalink
Merge pull request #1590 from projectblacklight/require_dependency
Browse files Browse the repository at this point in the history
Require dependency
  • Loading branch information
cbeer committed Dec 2, 2016
2 parents 57ce5af + 51d6b2b commit 061ac75
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Metrics/BlockNesting:
# Offense count: 2
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 184
Max: 200

# Offense count: 20
Metrics/CyclomaticComplexity:
Expand Down
27 changes: 13 additions & 14 deletions lib/blacklight/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ module Blacklight
# Blacklight::Configuration holds the configuration for a Blacklight::Controller, including
# fields to display, facets to show, sort options, and search fields.
class Configuration < OpenStructWithHashAccess
# Using required_dependency to work around Rails autoloading
# problems when developing blacklight. Without this, any change
# to this class breaks other classes in this namespace

require_dependency 'blacklight/configuration/context'
require_dependency 'blacklight/configuration/view_config'
require_dependency 'blacklight/configuration/tool_config'
# XXX this isn't very pretty, but it works.
require_dependency 'blacklight/configuration/fields'
require_dependency 'blacklight/configuration/field'
require_dependency 'blacklight/configuration/null_field'
require_dependency 'blacklight/configuration/search_field'
require_dependency 'blacklight/configuration/facet_field'
require_dependency 'blacklight/configuration/sort_field'
extend ActiveSupport::Autoload
eager_autoload do
autoload :Context
autoload :ViewConfig
autoload :ToolConfig
autoload :Fields
autoload :Field
autoload :NullField
autoload :SearchField
autoload :FacetField
autoload :SortField
end

include Fields

# Set up Blacklight::Configuration.default_values to contain
Expand Down
20 changes: 10 additions & 10 deletions lib/blacklight/solr/response.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# frozen_string_literal: true
class Blacklight::Solr::Response < ActiveSupport::HashWithIndifferentAccess
# Using required_dependency to work around Rails autoloading
# problems when developing blacklight. Without this, any change
# to this class breaks other classes in this namespace
require_dependency 'blacklight/solr/response/pagination_methods'
require_dependency 'blacklight/solr/response/response'
require_dependency 'blacklight/solr/response/spelling'
require_dependency 'blacklight/solr/response/facets'
require_dependency 'blacklight/solr/response/more_like_this'
require_dependency 'blacklight/solr/response/group_response'
require_dependency 'blacklight/solr/response/group'
extend ActiveSupport::Autoload
eager_autoload do
autoload :PaginationMethods
autoload :Response
autoload :Spelling
autoload :Facets
autoload :MoreLikeThis
autoload :GroupResponse
autoload :Group
end

include PaginationMethods
include Spelling
Expand Down

0 comments on commit 061ac75

Please sign in to comment.