harvestdor-indexer 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aaba4e6dc5856b407d053a43875f26dd9f76bf47
4
- data.tar.gz: bce6c1c859e20d63e8c7503c49ca7a0f86668f5c
3
+ metadata.gz: 0bd4c79cdbea501ef4549633064ea37f6de7b913
4
+ data.tar.gz: 5296b05a6bb874a4484d7b3bd4e2f4096c893727
5
5
  SHA512:
6
- metadata.gz: faed68b259bd191dee7d54d407a9c0aca9326999bb02b4b34ce035f05ce01a0a2ed9ed35a9b3135824f311d815d6ff158d2f8f5111d2c2db62b33ffed07b11b0
7
- data.tar.gz: 1ca560db599096a21e9346404fd00544a2ed35bdb7684c9318f6d4a5e60c10e4b82124ce6edad8346471b5f8903ed73e6fbcd2c6c6926a16de7c30bea3416b48
6
+ metadata.gz: 4f158a525f96570befbd08eb07dd66d768603babcb13c8c57e9dbcee07bdfc710c61877c6a5d3459984a82f624b118c5ac26d4448ada51c446e71af10b2f3faf
7
+ data.tar.gz: 2e5cdfe81ad7341eabb4bf8c8f1378f0989ff56d146c64739d833cff2144aee16e4f73f2554cb75ebddd6ff16ce56070c632bc8e85707f55463cc244973406c5
@@ -1,12 +1,12 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2015-10-26 16:12:34 -0700 using RuboCop version 0.34.2.
3
+ # on 2016-07-25 14:19:00 -0700 using RuboCop version 0.42.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 4
9
+ # Offense count: 5
10
10
  Lint/UselessAssignment:
11
11
  Exclude:
12
12
  - 'lib/harvestdor/indexer.rb'
@@ -16,16 +16,24 @@ Lint/UselessAssignment:
16
16
  Metrics/AbcSize:
17
17
  Max: 20
18
18
 
19
- # Offense count: 1
20
- # Configuration parameters: CountComments.
21
- Metrics/ClassLength:
22
- Max: 105
23
-
24
- # Offense count: 96
25
- # Configuration parameters: AllowURI, URISchemes.
19
+ # Offense count: 107
20
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
21
+ # URISchemes: http, https
26
22
  Metrics/LineLength:
27
23
  Max: 207
28
24
 
25
+ # Offense count: 2
26
+ RSpec/AnyInstance:
27
+ Exclude:
28
+ - 'spec/unit/harvestdor-indexer_spec.rb'
29
+
30
+ # Offense count: 13
31
+ # Configuration parameters: Max.
32
+ RSpec/ExampleLength:
33
+ Exclude:
34
+ - 'spec/unit/harvestdor-indexer-resource_spec.rb'
35
+ - 'spec/unit/harvestdor-indexer_spec.rb'
36
+
29
37
  # Offense count: 3
30
38
  # Configuration parameters: CustomTransform.
31
39
  RSpec/FilePath:
@@ -34,40 +42,53 @@ RSpec/FilePath:
34
42
  - 'spec/unit/harvestdor-indexer-solr_spec.rb'
35
43
  - 'spec/unit/harvestdor-indexer_spec.rb'
36
44
 
37
- # Offense count: 102
45
+ # Offense count: 106
38
46
  RSpec/InstanceVariable:
39
47
  Exclude:
40
48
  - 'spec/unit/harvestdor-indexer-resource_spec.rb'
41
49
  - 'spec/unit/harvestdor-indexer_spec.rb'
42
50
 
51
+ # Offense count: 1
52
+ # Configuration parameters: IgnoreSymbolicNames.
53
+ RSpec/VerifiedDoubles:
54
+ Exclude:
55
+ - 'spec/unit/harvestdor-indexer-solr_spec.rb'
56
+
43
57
  # Offense count: 3
44
58
  # Cop supports --auto-correct.
45
59
  # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
60
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining
61
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
62
+ # FunctionalMethods: let, let!, subject, watch
63
+ # IgnoredMethods: lambda, proc, it
46
64
  Style/BlockDelimiters:
47
- Enabled: false
65
+ Exclude:
66
+ - 'spec/unit/harvestdor-indexer_spec.rb'
48
67
 
49
68
  # Offense count: 2
50
69
  # Cop supports --auto-correct.
51
70
  # Configuration parameters: EnforcedStyle, SupportedStyles.
71
+ # SupportedStyles: braces, no_braces, context_dependent
52
72
  Style/BracesAroundHashParameters:
53
73
  Exclude:
54
74
  - 'spec/unit/harvestdor-indexer_spec.rb'
55
75
 
56
76
  # Offense count: 3
57
77
  # Configuration parameters: EnforcedStyle, SupportedStyles.
78
+ # SupportedStyles: nested, compact
58
79
  Style/ClassAndModuleChildren:
59
80
  Exclude:
60
81
  - 'lib/harvestdor/indexer/metrics.rb'
61
82
  - 'lib/harvestdor/indexer/resource.rb'
62
83
  - 'lib/harvestdor/indexer/solr.rb'
63
84
 
64
- # Offense count: 3
65
- # Configuration parameters: Exclude.
85
+ # Offense count: 2
66
86
  Style/Documentation:
67
87
  Exclude:
88
+ - 'spec/**/*'
89
+ - 'test/**/*'
68
90
  - 'lib/harvestdor/indexer/resource.rb'
69
91
  - 'lib/harvestdor/indexer/solr.rb'
70
- - 'lib/harvestdor/indexer/version.rb'
71
92
 
72
93
  # Offense count: 1
73
94
  Style/DoubleNegation:
@@ -75,21 +96,10 @@ Style/DoubleNegation:
75
96
  - 'lib/harvestdor/indexer/resource.rb'
76
97
 
77
98
  # Offense count: 4
78
- # Configuration parameters: Exclude.
99
+ # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
79
100
  Style/FileName:
80
101
  Exclude:
81
102
  - 'lib/harvestdor-indexer.rb'
82
103
  - 'spec/unit/harvestdor-indexer-resource_spec.rb'
83
104
  - 'spec/unit/harvestdor-indexer-solr_spec.rb'
84
105
  - 'spec/unit/harvestdor-indexer_spec.rb'
85
-
86
- # Offense count: 1
87
- # Configuration parameters: MinBodyLength.
88
- Style/GuardClause:
89
- Exclude:
90
- - 'lib/harvestdor/indexer.rb'
91
-
92
- # Offense count: 1
93
- Style/MultilineBlockChain:
94
- Exclude:
95
- - 'lib/harvestdor/indexer.rb'
@@ -103,9 +103,7 @@ module Harvestdor
103
103
  end
104
104
 
105
105
  def resource_error(e)
106
- if e.instance_of?(Parallel::Break) || e.instance_of?(Parallel::Kill)
107
- fail e
108
- end
106
+ raise e if e.instance_of?(Parallel::Break) || e.instance_of?(Parallel::Kill)
109
107
  end
110
108
 
111
109
  # return Array of druids contained in the DorFetcher pulling indicated by DorFetcher params
@@ -20,8 +20,8 @@ module Harvestdor
20
20
  #
21
21
  # @param [Hash] options
22
22
  # @option options [#call] Callback that will receive any exception thrown by the block
23
- def tally(options = {}, &block)
24
- block.call
23
+ def tally(options = {})
24
+ yield
25
25
  success!
26
26
  rescue => e
27
27
  error!
@@ -84,7 +84,7 @@ module Harvestdor
84
84
  def smods_rec
85
85
  @smods_rec ||= benchmark "smods_rec(#{druid})", level: :debug do
86
86
  ng_doc = mods
87
- fail "Empty MODS metadata for #{druid}: #{ng_doc.to_xml}" if ng_doc.root.xpath('//text()').empty?
87
+ raise "Empty MODS metadata for #{druid}: #{ng_doc.to_xml}" if ng_doc.root.xpath('//text()').empty?
88
88
  mods_rec = Stanford::Mods::Record.new
89
89
  mods_rec.from_nk_node(ng_doc.root)
90
90
  mods_rec
@@ -100,8 +100,8 @@ module Harvestdor
100
100
  def public_xml
101
101
  @public_xml ||= benchmark "public_xml(#{druid})", level: :debug do
102
102
  ng_doc = harvestdor_client.public_xml bare_druid
103
- fail "No public xml for #{druid}" unless ng_doc
104
- fail "Empty public xml for #{druid}: #{ng_doc.to_xml}" if ng_doc.root.xpath('//text()').empty?
103
+ raise "No public xml for #{druid}" unless ng_doc
104
+ raise "Empty public xml for #{druid}: #{ng_doc.to_xml}" if ng_doc.root.xpath('//text()').empty?
105
105
  ng_doc
106
106
  end
107
107
  end
@@ -126,41 +126,41 @@ module Harvestdor
126
126
  # the contentMetadata for this DOR object, ultimately from the purl public xml
127
127
  # @return [Nokogiri::XML::Document] the contentMetadata for the DOR object
128
128
  def content_metadata
129
- ng_doc = benchmark "content_metadata (#{druid})", level: :debug do
129
+ @content_metadata ||= benchmark "content_metadata (#{druid})", level: :debug do
130
130
  harvestdor_client.content_metadata public_xml_or_druid
131
131
  end
132
- fail "No contentMetadata for \"#{druid}\"" if !ng_doc || ng_doc.children.empty?
133
- ng_doc
132
+ raise "No contentMetadata for \"#{druid}\"" if !@content_metadata || @content_metadata.children.empty?
133
+ @content_metadata
134
134
  end
135
135
 
136
136
  # the identityMetadata for this DOR object, ultimately from the purl public xml
137
137
  # @return [Nokogiri::XML::Document] the identityMetadata for the DOR object
138
138
  def identity_metadata
139
- ng_doc = benchmark "identity_metadata (#{druid})", level: :debug do
139
+ @identity_metadata ||= benchmark "identity_metadata (#{druid})", level: :debug do
140
140
  harvestdor_client.identity_metadata public_xml_or_druid
141
141
  end
142
- fail "No identityMetadata for \"#{druid}\"" if !ng_doc || ng_doc.children.empty?
143
- ng_doc
142
+ raise "No identityMetadata for \"#{druid}\"" if !@identity_metadata || @identity_metadata.children.empty?
143
+ @identity_metadata
144
144
  end
145
145
 
146
146
  # the rightsMetadata for this DOR object, ultimately from the purl public xml
147
147
  # @return [Nokogiri::XML::Document] the rightsMetadata for the DOR object
148
148
  def rights_metadata
149
- ng_doc = benchmark "rights_metadata (#{druid})", level: :debug do
149
+ @rights_metadata ||= benchmark "rights_metadata (#{druid})", level: :debug do
150
150
  harvestdor_client.rights_metadata public_xml_or_druid
151
151
  end
152
- fail "No rightsMetadata for \"#{druid}\"" if !ng_doc || ng_doc.children.empty?
153
- ng_doc
152
+ raise "No rightsMetadata for \"#{druid}\"" if !@rights_metadata || @rights_metadata.children.empty?
153
+ @rights_metadata
154
154
  end
155
155
 
156
156
  # the RDF for this DOR object, ultimately from the purl public xml
157
157
  # @return [Nokogiri::XML::Document] the RDF for the DOR object
158
158
  def rdf
159
- ng_doc = benchmark "rdf (#{druid})", level: :debug do
159
+ @rdf ||= benchmark "rdf (#{druid})", level: :debug do
160
160
  harvestdor_client.rdf public_xml_or_druid
161
161
  end
162
- fail "No RDF for \"#{druid}\"" if !ng_doc || ng_doc.children.empty?
163
- ng_doc
162
+ raise "No RDF for \"#{druid}\"" if !@rdf || @rdf.children.empty?
163
+ @rdf
164
164
  end
165
165
 
166
166
  def eql?(other)
@@ -1,6 +1,6 @@
1
1
  module Harvestdor
2
2
  class Indexer
3
3
  # this is the Ruby Gem version
4
- VERSION = '2.3.1'
4
+ VERSION = '2.3.2'.freeze
5
5
  end
6
6
  end
@@ -81,7 +81,7 @@ describe Harvestdor::Indexer::Resource do
81
81
  before(:all) do
82
82
  @id_md_xml = "<identityMetadata><objectId>druid:#{@fake_druid}</objectId></identityMetadata>"
83
83
  @cntnt_md_xml = "<contentMetadata type='image' objectId='#{@fake_druid}'>foo</contentMetadata>"
84
- @rights_md_xml = "<rightsMetadata><access type=\"discover\"><machine><world>bar</world></machine></access></rightsMetadata>"
84
+ @rights_md_xml = '<rightsMetadata><access type="discover"><machine><world>bar</world></machine></access></rightsMetadata>'
85
85
  @rdf_xml = "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about=\"info:fedora/druid:#{@fake_druid}\">relationship!</rdf:Description></rdf:RDF>"
86
86
  @pub_xml = "<publicObject id='druid:#{@fake_druid}'>#{@id_md_xml}#{@cntnt_md_xml}#{@rights_md_xml}#{@rdf_xml}</publicObject>"
87
87
  @ng_pub_xml = Nokogiri::XML(@pub_xml)
@@ -186,7 +186,7 @@ describe Harvestdor::Indexer::Resource do
186
186
 
187
187
  describe '#collections' do
188
188
  it 'extracts the collection this resource is a member of and return Resource objects for those collections' do
189
- allow(resource).to receive(:public_xml).and_return(Nokogiri::XML <<-EOF
189
+ allow(resource).to receive(:public_xml).and_return(Nokogiri::XML(<<-EOF)
190
190
  <publicObject>
191
191
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:fedora="info:fedora/fedora-system:def/relations-external#">
192
192
  <rdf:Description>
@@ -47,7 +47,7 @@ describe Harvestdor::Indexer do
47
47
  a = @indexer.resources.first
48
48
  b = @indexer.resources.first
49
49
 
50
- expect(a).to_not eq b
50
+ expect(a).not_to eq b
51
51
  end
52
52
  end
53
53
  end
@@ -30,7 +30,7 @@ describe Harvestdor::Indexer::Metrics do
30
30
  it 'records an error if the block fails' do
31
31
  expect do
32
32
  subject.tally do
33
- fail 'Broken'
33
+ raise 'Broken'
34
34
  end
35
35
  end.to change { subject.error_count }.from(0).to(1)
36
36
  end
@@ -39,7 +39,7 @@ describe Harvestdor::Indexer::Metrics do
39
39
  x = double
40
40
  expect(x).to receive(:call).with(kind_of(RuntimeError))
41
41
  subject.tally(on_error: x) do
42
- fail 'Broken'
42
+ raise 'Broken'
43
43
  end
44
44
  end
45
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harvestdor-indexer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-03 00:00:00.000000000 Z
13
+ date: 2016-07-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsolr
@@ -308,7 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
308
308
  version: '0'
309
309
  requirements: []
310
310
  rubyforge_project:
311
- rubygems_version: 2.4.5.1
311
+ rubygems_version: 2.6.4
312
312
  signing_key:
313
313
  specification_version: 4
314
314
  summary: Harvest DOR object metadata and index it to Solr
@@ -325,4 +325,3 @@ test_files:
325
325
  - spec/unit/harvestdor-indexer-solr_spec.rb
326
326
  - spec/unit/harvestdor-indexer_spec.rb
327
327
  - spec/unit/harvestdor/indexer/metrics_spec.rb
328
- has_rdoc: