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 +4 -4
- data/.rubocop_todo.yml +36 -26
- data/lib/harvestdor/indexer.rb +1 -3
- data/lib/harvestdor/indexer/metrics.rb +2 -2
- data/lib/harvestdor/indexer/resource.rb +15 -15
- data/lib/harvestdor/indexer/version.rb +1 -1
- data/spec/unit/harvestdor-indexer-resource_spec.rb +2 -2
- data/spec/unit/harvestdor-indexer_spec.rb +1 -1
- data/spec/unit/harvestdor/indexer/metrics_spec.rb +2 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bd4c79cdbea501ef4549633064ea37f6de7b913
|
4
|
+
data.tar.gz: 5296b05a6bb874a4484d7b3bd4e2f4096c893727
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f158a525f96570befbd08eb07dd66d768603babcb13c8c57e9dbcee07bdfc710c61877c6a5d3459984a82f624b118c5ac26d4448ada51c446e71af10b2f3faf
|
7
|
+
data.tar.gz: 2e5cdfe81ad7341eabb4bf8c8f1378f0989ff56d146c64739d833cff2144aee16e4f73f2554cb75ebddd6ff16ce56070c632bc8e85707f55463cc244973406c5
|
data/.rubocop_todo.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
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:
|
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:
|
20
|
-
# Configuration parameters:
|
21
|
-
|
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:
|
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
|
-
|
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:
|
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:
|
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'
|
data/lib/harvestdor/indexer.rb
CHANGED
@@ -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 = {}
|
24
|
-
|
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
|
-
|
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
|
-
|
104
|
-
|
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
|
-
|
129
|
+
@content_metadata ||= benchmark "content_metadata (#{druid})", level: :debug do
|
130
130
|
harvestdor_client.content_metadata public_xml_or_druid
|
131
131
|
end
|
132
|
-
|
133
|
-
|
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
|
-
|
139
|
+
@identity_metadata ||= benchmark "identity_metadata (#{druid})", level: :debug do
|
140
140
|
harvestdor_client.identity_metadata public_xml_or_druid
|
141
141
|
end
|
142
|
-
|
143
|
-
|
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
|
-
|
149
|
+
@rights_metadata ||= benchmark "rights_metadata (#{druid})", level: :debug do
|
150
150
|
harvestdor_client.rights_metadata public_xml_or_druid
|
151
151
|
end
|
152
|
-
|
153
|
-
|
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
|
-
|
159
|
+
@rdf ||= benchmark "rdf (#{druid})", level: :debug do
|
160
160
|
harvestdor_client.rdf public_xml_or_druid
|
161
161
|
end
|
162
|
-
|
163
|
-
|
162
|
+
raise "No RDF for \"#{druid}\"" if !@rdf || @rdf.children.empty?
|
163
|
+
@rdf
|
164
164
|
end
|
165
165
|
|
166
166
|
def eql?(other)
|
@@ -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 =
|
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
|
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>
|
@@ -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
|
-
|
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
|
-
|
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.
|
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:
|
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
|
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:
|