Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

Commit

Permalink
Merge 6803e6e into 776b61f
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Apr 8, 2019
2 parents 776b61f + 6803e6e commit 6da8cbf
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 149 deletions.
63 changes: 31 additions & 32 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-04-08 11:23:59 -0500 using RuboCop version 0.58.2.
# on 2019-04-08 12:25:57 -0500 using RuboCop version 0.58.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -72,15 +72,14 @@ Lint/ScriptPermission:
- 'Rakefile'
- 'devel/experiment.rb'

# Offense count: 4
# Offense count: 3
Lint/ShadowingOuterLocalVariable:
Exclude:
- 'app/models/hydrus/collection.rb'
- 'app/models/hydrus/licenseable.rb'
- 'config/rsolr_certificate.rb'
- 'lib/tasks/fixtures.rake'

# Offense count: 20
# Offense count: 17
# Cop supports --auto-correct.
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
Expand All @@ -92,13 +91,12 @@ Lint/UnusedBlockArgument:
- 'app/models/hydrus/generic_object.rb'
- 'app/models/hydrus/remediation_runner.rb'
- 'app/models/hydrus/responsible.rb'
- 'config/rsolr_certificate.rb'
- 'lib/tasks/fixtures.rake'
- 'lib/tasks/hydrus.rake'
- 'spec/features/collection_edit_spec.rb'
- 'spec/models/hydrus/collection_spec.rb'

# Offense count: 11
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
Lint/UnusedMethodArgument:
Expand All @@ -108,22 +106,35 @@ Lint/UnusedMethodArgument:
- 'app/models/hydrus/collection.rb'
- 'app/models/hydrus/solr_queryable.rb'
- 'app/uploaders/file_uploader.rb'
- 'config/rsolr_certificate.rb'
- 'config/rsolr_no_certificate.rb'
- 'devel/dashboard_experiment.rb'
- 'spec/helpers/application_helper_spec.rb'

# Offense count: 30
# Offense count: 29
Lint/UselessAssignment:
Enabled: false
Exclude:
- 'app/models/hydrus/collection.rb'
- 'app/models/hydrus/contributor.rb'
- 'app/models/hydrus/responsible.rb'
- 'app/models/hydrus/solr_queryable.rb'
- 'config/compass.rb'
- 'devel/dashboard_experiment.rb'
- 'devel/experiment.rb'
- 'spec/features/collection_create_spec.rb'
- 'spec/features/collection_edit_spec.rb'
- 'spec/features/item_create_spec.rb'
- 'spec/features/item_edit_spec.rb'
- 'spec/features/models/item_spec.rb'
- 'spec/helpers/application_helper_spec.rb'
- 'spec/models/hydrus/solr_queryable_spec.rb'
- 'spec/support/helpers.rb'

# Offense count: 1
# Configuration parameters: CheckForMethodsWithNoSideEffects.
Lint/Void:
Exclude:
- 'spec/features/item_create_spec.rb'

# Offense count: 45
# Offense count: 43
Metrics/AbcSize:
Max: 119

Expand All @@ -142,7 +153,7 @@ Metrics/ClassLength:
Metrics/CyclomaticComplexity:
Max: 22

# Offense count: 61
# Offense count: 59
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 82
Expand Down Expand Up @@ -307,7 +318,7 @@ Style/BarePercentLiterals:
- 'spec/models/hydrus/role_metadata_ds_spec.rb'
- 'spec/models/hydrus/solr_queryable_spec.rb'

# Offense count: 69
# Offense count: 68
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining
Expand All @@ -331,7 +342,7 @@ Style/BracesAroundHashParameters:
- 'spec/lib/is_druid_validator_spec.rb'
- 'spec/models/hydrus/item_spec.rb'

# Offense count: 34
# Offense count: 31
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: nested, compact
Expand Down Expand Up @@ -396,7 +407,7 @@ Style/DefWithParentheses:
- 'app/models/hy_time.rb'
- 'devel/list_all_hydrus_objects.rb'

# Offense count: 72
# Offense count: 70
Style/Documentation:
Enabled: false

Expand Down Expand Up @@ -444,7 +455,7 @@ Style/ExpandPathArguments:
- 'script/rails'
- 'spec/spec_helper.rb'

# Offense count: 171
# Offense count: 169
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: when_needed, always, never
Expand Down Expand Up @@ -531,7 +542,7 @@ Style/LineEndConcatenation:
Style/MethodCallWithoutArgsParentheses:
Enabled: false

# Offense count: 22
# Offense count: 20
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
Expand All @@ -542,23 +553,20 @@ Style/MethodDefParentheses:
- 'app/models/hydrus/generic_object.rb'
- 'app/models/hydrus/item.rb'
- 'app/models/hydrus/responsible.rb'
- 'config/rsolr_certificate.rb'
- 'config/rsolr_no_certificate.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/MultilineIfModifier:
Exclude:
- 'devel/create_test_item.rb'

# Offense count: 6
# Offense count: 5
Style/MultilineTernaryOperator:
Exclude:
- 'app/models/hydrus/cant.rb'
- 'app/models/hydrus/generic_ds.rb'
- 'app/models/hydrus/item.rb'
- 'app/models/hydrus/responsible.rb'
- 'config/rsolr_no_certificate.rb'

# Offense count: 1
Style/MultipleComparison:
Expand Down Expand Up @@ -659,7 +667,7 @@ Style/PreferredHashMethods:
- 'app/helpers/hydrus_form_helper.rb'
- 'devel/create_test_item.rb'

# Offense count: 5
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: compact, exploded
Expand All @@ -668,7 +676,6 @@ Style/RaiseArgs:
- 'app/controllers/datastreams_controller.rb'
- 'app/controllers/events_controller.rb'
- 'app/controllers/hydrus_items_controller.rb'
- 'config/rsolr_no_certificate.rb'

# Offense count: 1
# Cop supports --auto-correct.
Expand Down Expand Up @@ -734,14 +741,6 @@ Style/SafeNavigation:
- 'app/models/hydrus/responsible.rb'
- 'devel/create_test_item.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: use_perl_names, use_english_names
Style/SpecialGlobalVars:
Exclude:
- 'config/rsolr_no_certificate.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
Expand Down Expand Up @@ -855,7 +854,7 @@ Style/WordArray:
Style/ZeroLengthPredicate:
Enabled: false

# Offense count: 944
# Offense count: 935
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ end

gem 'honeybadger'
gem 'rsolr-ext'
gem 'rsolr', '~> 1.1'
gem 'rsolr', '~> 2.2'
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,9 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
retries (0.0.5)
rsolr (1.1.2)
rsolr (2.2.1)
builder (>= 2.1.2)
faraday (>= 0.9.0)
rsolr-ext (1.0.3)
rsolr (>= 1.0.2)
rspec-core (3.8.0)
Expand Down Expand Up @@ -555,7 +556,7 @@ DEPENDENCIES
okcomputer
pry
rails (~> 4.2.9)
rsolr (~> 1.1)
rsolr (~> 2.2)
rsolr-ext
rspec-rails (~> 3.1)
rubocop (~> 0.58.1)
Expand Down
4 changes: 2 additions & 2 deletions app/models/hydrus/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -686,11 +686,11 @@ def self.item_counts_of_collections(coll_pids)
counts
end

# Takes a SOLR response.
# @param [RSolr::HashWithResponse]
# Returns an array of hashes containing the needed facet counts.
# Written as a separate method for testing purposes.
def self.get_facet_counts_from_response(resp)
resp.facet_counts['facet_pivot'].values.first
resp.fetch('facet_counts').fetch('facet_pivot').values.first
end

# Returns an array-of-arrays containing the collection's @item_counts
Expand Down
2 changes: 1 addition & 1 deletion app/models/hydrus/responsible.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def self.roles_of_person person_id, apo_id
h[:fl] = '*'
resp, sdocs = Hydrus::SolrQueryable.issue_solr_query(h)
# only 1 doc
doc = resp.docs.first
doc = resp.fetch('response').fetch('docs').first
roles.keys.each do |key|
# the solr field is based on the role name, but doesnt match it precisely
field_name = key.gsub('hydrus-', '').gsub('-', '_') + '_person_identifier_t'
Expand Down
12 changes: 6 additions & 6 deletions app/models/hydrus/solr_queryable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def issue_solr_query(*args)

# This static version was added specifically to deal with loading the dashboard without instantiating an object.
def self.issue_solr_query(h)
solr_response = solr.find(h)
document_list = solr_response.docs.map { |doc| SolrDocument.new(doc, solr_response) }
solr_response = solr.post('select', data: h)
document_list = solr_response.fetch('response').fetch('docs').map { |doc| SolrDocument.new(doc, solr_response) }
[solr_response, document_list]
end

Expand Down Expand Up @@ -187,11 +187,11 @@ def all_hydrus_objects(opts = {})
data
end

# Takes a SOLR response.
# Returns an array of druids corresponding to the documents.
# @param [RSolr::HashWithResponse]
# @return [Array<String>] an array of druids corresponding to the documents.
def get_druids_from_response(resp)
k = 'objectId_ssim'
resp.docs.map { |doc| doc[k].first }
resp.fetch('response').fetch('docs').map { |doc| doc[k].first }
end

# Takes a SOLR response and a hash of field remappings.
Expand All @@ -203,7 +203,7 @@ def get_druids_from_response(resp)
# When retrieving values from the SOLR documents, only the first
# values for each key is retained.
def get_fields_from_response(resp, fields)
resp.docs.map { |doc|
resp.fetch('response').fetch('docs').map { |doc|
h = {}
fields.each { |solr_doc_key, remapped_key|
d = doc[solr_doc_key]
Expand Down
3 changes: 0 additions & 3 deletions config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

current_path = File.dirname(__FILE__)

# Override make_solr_connection() so that we use POST for solr queries
require File.expand_path(File.join(current_path, 'rsolr_no_certificate'))

Hydrus::Application.configure do
# this is the path from the root of the public folder into which file uploads will be stored
config.file_upload_path = 'uploads'
Expand Down
52 changes: 0 additions & 52 deletions config/rsolr_certificate.rb

This file was deleted.

38 changes: 0 additions & 38 deletions config/rsolr_no_certificate.rb

This file was deleted.

Loading

0 comments on commit 6da8cbf

Please sign in to comment.