geo_combine 0.8.0 → 0.9.1
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/.github/workflows/ruby.yml +3 -6
- data/.rubocop.yml +4 -1
- data/.rubocop_todo.yml +16 -19
- data/README.md +47 -22
- data/geo_combine.gemspec +1 -0
- data/lib/geo_combine/ckan_metadata.rb +5 -4
- data/lib/geo_combine/geo_blacklight_harvester.rb +17 -12
- data/lib/geo_combine/geoblacklight.rb +1 -1
- data/lib/geo_combine/harvester.rb +33 -16
- data/lib/geo_combine/indexer.rb +104 -25
- data/lib/geo_combine/logger.rb +16 -0
- data/lib/geo_combine/migrators/v1_aardvark_migrator.rb +81 -10
- data/lib/geo_combine/ogp.rb +1 -1
- data/lib/geo_combine/version.rb +1 -1
- data/lib/tasks/geo_combine.rake +3 -7
- data/spec/fixtures/docs/full_geoblacklight.json +8 -1
- data/spec/fixtures/docs/full_geoblacklight_aardvark.json +27 -8
- data/spec/lib/geo_combine/geo_blacklight_harvester_spec.rb +5 -4
- data/spec/lib/geo_combine/harvester_spec.rb +8 -22
- data/spec/lib/geo_combine/indexer_spec.rb +92 -21
- data/spec/lib/geo_combine/migrators/v1_aardvark_migrator_spec.rb +29 -5
- data/spec/lib/geo_combine_spec.rb +20 -17
- data/spec/spec_helper.rb +1 -1
- metadata +18 -3
@@ -6,17 +6,41 @@ RSpec.describe GeoCombine::Migrators::V1AardvarkMigrator do
|
|
6
6
|
include JsonDocs
|
7
7
|
|
8
8
|
describe '#run' do
|
9
|
-
it 'migrates
|
9
|
+
it 'migrates fields to new names and types' do
|
10
10
|
input_hash = JSON.parse(full_geoblacklight)
|
11
|
-
# TODO: Note that this fixture has not yet been fully converted to
|
12
|
-
# aardvark. See https://github.com/OpenGeoMetadata/GeoCombine/issues/121
|
13
|
-
# for remaining work.
|
14
11
|
expected_output = JSON.parse(full_geoblacklight_aardvark)
|
15
12
|
expect(described_class.new(v1_hash: input_hash).run).to eq(expected_output)
|
16
13
|
end
|
17
14
|
|
15
|
+
it 'removes deprecated fields' do
|
16
|
+
input_hash = JSON.parse(full_geoblacklight)
|
17
|
+
output = described_class.new(v1_hash: input_hash).run
|
18
|
+
expect(output.keys).not_to include(described_class::SCHEMA_FIELD_MAP.keys)
|
19
|
+
expect(output.keys).not_to include('dc_type_s')
|
20
|
+
expect(output.keys).not_to include('layer_geom_type_s')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'leaves custom fields unchanged' do
|
24
|
+
input_hash = JSON.parse(full_geoblacklight)
|
25
|
+
input_hash['custom_field'] = 'custom_value'
|
26
|
+
output = described_class.new(v1_hash: input_hash).run
|
27
|
+
expect(output['custom_field']).to eq('custom_value')
|
28
|
+
end
|
29
|
+
|
18
30
|
context 'when the given record is already in aardvark schema' do
|
19
|
-
|
31
|
+
it 'returns the record unchanged' do
|
32
|
+
input_hash = JSON.parse(full_geoblacklight_aardvark)
|
33
|
+
expect(described_class.new(v1_hash: input_hash).run).to eq(input_hash)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when the user supplies a mapping for collection names to ids' do
|
38
|
+
it 'converts the collection names to ids' do
|
39
|
+
input_hash = JSON.parse(full_geoblacklight)
|
40
|
+
collection_id_map = { 'Uganda GIS Maps and Data, 2000-2010' => 'stanford-rb371kw9607' }
|
41
|
+
output = described_class.new(v1_hash: input_hash, collection_id_map:).run
|
42
|
+
expect(output['dct_isPartOf_sm']).to eq(['stanford-rb371kw9607'])
|
43
|
+
end
|
20
44
|
end
|
21
45
|
end
|
22
46
|
end
|
@@ -2,25 +2,28 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
RSpec.describe GeoCombine
|
5
|
+
RSpec.describe GeoCombine do
|
6
6
|
include XmlDocs
|
7
|
-
describe '#initialize' do
|
8
|
-
it 'reads metadata from file if File is readable' do
|
9
|
-
expect(File).to receive(:readable?).and_return(true)
|
10
|
-
expect(File).to receive(:read).and_return(simple_xml)
|
11
|
-
metadata_object = described_class.new('./tmp/fake/file/location')
|
12
|
-
expect(metadata_object).to be_an described_class
|
13
|
-
expect(metadata_object.metadata).to be_an Nokogiri::XML::Document
|
14
|
-
expect(metadata_object.metadata.css('Author').count).to eq 2
|
15
|
-
end
|
16
7
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
8
|
+
describe GeoCombine::Metadata do
|
9
|
+
describe '#initialize' do
|
10
|
+
it 'reads metadata from file if File is readable' do
|
11
|
+
expect(File).to receive(:readable?).and_return(true)
|
12
|
+
expect(File).to receive(:read).and_return(simple_xml)
|
13
|
+
metadata_object = described_class.new('./tmp/fake/file/location')
|
14
|
+
expect(metadata_object).to be_an described_class
|
15
|
+
expect(metadata_object.metadata).to be_an Nokogiri::XML::Document
|
16
|
+
expect(metadata_object.metadata.css('Author').count).to eq 2
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'reads metadata from parameter if File is not readable' do
|
20
|
+
metadata_object = described_class.new(simple_xml)
|
21
|
+
expect(metadata_object).to be_an described_class
|
22
|
+
expect(metadata_object.metadata).to be_an Nokogiri::XML::Document
|
23
|
+
expect(metadata_object.metadata.css('Author').count).to eq 2
|
24
|
+
end
|
22
25
|
end
|
26
|
+
# GeoCombine subclasses should individually test `to_geoblacklight` and
|
27
|
+
# `to_html` methods
|
23
28
|
end
|
24
|
-
# GeoCombine subclasses should individually test `to_geoblacklight` and
|
25
|
-
# `to_html` methods
|
26
29
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -22,7 +22,7 @@ require 'webmock/rspec'
|
|
22
22
|
WebMock.allow_net_connect!
|
23
23
|
|
24
24
|
# include the spec support files
|
25
|
-
Dir['./spec/support/**/*.rb'].
|
25
|
+
Dir['./spec/support/**/*.rb'].each { |f| require f }
|
26
26
|
|
27
27
|
RSpec.configure do |config|
|
28
28
|
config.include Helpers
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geo_combine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Reed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: faraday-retry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.2'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.2'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: bundler
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -279,6 +293,7 @@ files:
|
|
279
293
|
- lib/geo_combine/harvester.rb
|
280
294
|
- lib/geo_combine/indexer.rb
|
281
295
|
- lib/geo_combine/iso19139.rb
|
296
|
+
- lib/geo_combine/logger.rb
|
282
297
|
- lib/geo_combine/migrators/v1_aardvark_migrator.rb
|
283
298
|
- lib/geo_combine/ogp.rb
|
284
299
|
- lib/geo_combine/railtie.rb
|
@@ -361,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
361
376
|
- !ruby/object:Gem::Version
|
362
377
|
version: '0'
|
363
378
|
requirements: []
|
364
|
-
rubygems_version: 3.
|
379
|
+
rubygems_version: 3.4.19
|
365
380
|
signing_key:
|
366
381
|
specification_version: 4
|
367
382
|
summary: A Ruby toolkit for managing geospatial metadata
|