geo_concerns 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -2
- data/Rakefile +4 -3
- data/app/actors/geo_concerns/actors/file_actor.rb +11 -5
- data/app/schemas/geo_concerns/basic_geo_metadata_optional.rb +2 -1
- data/app/schemas/geo_concerns/basic_geo_metadata_required.rb +1 -1
- data/app/services/geo_concerns/delivery/geoserver.rb +12 -6
- data/config/fcrepo_wrapper_test.yml +3 -0
- data/config/solr_wrapper_test.yml +7 -0
- data/geo_concerns.gemspec +2 -2
- data/lib/geo_concerns/version.rb +1 -1
- data/run-docker.sh +2 -3
- data/spec/services/geo_concerns/delivery/geoserver_spec.rb +18 -22
- data/tasks/geo_concerns.rake +1 -1
- data/template.rb +2 -2
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7a2c566517e2692c326da44ff6ac325a8605e91
|
4
|
+
data.tar.gz: 19af506201f28b351939901a46fb02dd599c6ff7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07c9520851640a1241417a758dea76fc4bc284e1463ee62d39b14de0b6bc675bf1e8063843b31d8a4d9ef664d094eb903a3758fc5b02ac68e744847586382cf5
|
7
|
+
data.tar.gz: 6d097f13341e4f4d5350bf89f6dba9f9eaff1a6808c5229b1a4993e4c6cea48244368e3d82fc6bf39211e2c0b382a5daa5f928d545e14f323ca3cc032e2a451c
|
data/README.md
CHANGED
@@ -57,7 +57,6 @@ Add GeoConcerns models to an existing CurationConcerns application:
|
|
57
57
|
1. `bundle install`
|
58
58
|
2. `rake engine_cart:generate`
|
59
59
|
3. `rake geo_concerns:dev_servers`
|
60
|
-
4. `cd .internal_test_app && rails s`
|
61
60
|
|
62
61
|
## Testing
|
63
62
|
|
@@ -74,6 +73,11 @@ Then, in another terminal window:
|
|
74
73
|
```
|
75
74
|
$ rake spec
|
76
75
|
```
|
76
|
+
To run a specific test:
|
77
|
+
|
78
|
+
```bash
|
79
|
+
rspec spec/path/to/your_spec.rb:linenumber
|
80
|
+
```
|
77
81
|
|
78
82
|
## Running GeoServer for Development with Docker
|
79
83
|
|
@@ -87,6 +91,12 @@ $ rake spec
|
|
87
91
|
```
|
88
92
|
$ source ./run-docker.sh
|
89
93
|
```
|
94
|
+
1. To stop the server and remove port forwarding:
|
95
|
+
|
96
|
+
```
|
97
|
+
$ docker-compose stop
|
98
|
+
$ killall ssh
|
99
|
+
```
|
90
100
|
|
91
101
|
### Linux
|
92
102
|
|
@@ -98,7 +108,6 @@ $ rake spec
|
|
98
108
|
|
99
109
|
```
|
100
110
|
$ docker-compose up -d
|
101
|
-
$ export GEOSERVER_URL="http://localhost:8181/geoserver/rest"
|
102
111
|
```
|
103
112
|
|
104
113
|
## Running GeoServer for Development with Vagrant
|
data/Rakefile
CHANGED
@@ -7,17 +7,18 @@ require 'engine_cart/rake_task'
|
|
7
7
|
require 'rspec/core/rake_task'
|
8
8
|
require 'rubocop/rake_task'
|
9
9
|
require 'active_fedora/rake_support'
|
10
|
+
require 'solr_wrapper/rake_task'
|
10
11
|
|
11
12
|
Dir.glob('tasks/*.rake').each { |r| import r }
|
12
13
|
|
13
14
|
Bundler::GemHelper.install_tasks
|
14
15
|
|
15
|
-
desc 'Run test suite
|
16
|
-
task spec: ['geo_concerns:
|
16
|
+
desc 'Run test suite'
|
17
|
+
task spec: ['geo_concerns:rspec']
|
17
18
|
|
18
19
|
desc 'Spin up Solr & Fedora and run the test suite'
|
19
20
|
task ci: ['geo_concerns:rubocop', 'engine_cart:generate'] do
|
20
|
-
Rake::Task['spec'].invoke
|
21
|
+
Rake::Task['geo_concerns:spec'].invoke
|
21
22
|
end
|
22
23
|
|
23
24
|
task clean: 'engine_cart:clean'
|
@@ -2,13 +2,10 @@ module GeoConcerns
|
|
2
2
|
module Actors
|
3
3
|
class FileActor < CurationConcerns::Actors::FileActor
|
4
4
|
def ingest_file(file)
|
5
|
-
working_file = CurationConcerns::WorkingDirectory
|
6
|
-
.copy_file_to_working_directory(file, file_set.id)
|
7
5
|
IngestFileJob.perform_later(file_set,
|
8
|
-
working_file,
|
9
|
-
mime_type(file),
|
6
|
+
working_file(file),
|
10
7
|
user,
|
11
|
-
|
8
|
+
ingest_options(file))
|
12
9
|
true
|
13
10
|
end
|
14
11
|
|
@@ -21,6 +18,15 @@ module GeoConcerns
|
|
21
18
|
return file_set.geo_mime_type if file_set.geo_mime_type
|
22
19
|
file.respond_to?(:content_type) ? file.content_type : nil || file_set.geo_mime_type
|
23
20
|
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def ingest_options(file, opts = {})
|
25
|
+
opts[:mime_type] = mime_type(file)
|
26
|
+
opts[:filename] = file.original_filename if file.respond_to?(:original_filename)
|
27
|
+
opts[:relation] = relation
|
28
|
+
opts
|
29
|
+
end
|
24
30
|
end
|
25
31
|
end
|
26
32
|
end
|
@@ -3,7 +3,7 @@ module GeoConcerns
|
|
3
3
|
#
|
4
4
|
# The following properties are inherited from Curation Concerns' metadata
|
5
5
|
#
|
6
|
-
# @see https://github.com/projecthydra/curation_concerns/blob/v1.
|
6
|
+
# @see https://github.com/projecthydra/curation_concerns/blob/v1.6.0/app/models/concerns/curation_concerns/basic_metadata.rb
|
7
7
|
# Optional:
|
8
8
|
# :contributor
|
9
9
|
# :creator
|
@@ -14,6 +14,7 @@ module GeoConcerns
|
|
14
14
|
# :part_of
|
15
15
|
# :publisher
|
16
16
|
# :resource_type (DC.type)
|
17
|
+
# :rights (license)
|
17
18
|
# :rights
|
18
19
|
# :source
|
19
20
|
# :subject
|
@@ -3,7 +3,7 @@ module GeoConcerns
|
|
3
3
|
#
|
4
4
|
# The following properties are inherited from Curation Concerns' metadata
|
5
5
|
#
|
6
|
-
# @see https://github.com/projecthydra/curation_concerns/blob/v1.
|
6
|
+
# @see https://github.com/projecthydra/curation_concerns/blob/v1.6.0/app/models/concerns/curation_concerns/required_metadata.rb
|
7
7
|
# Required:
|
8
8
|
# :title
|
9
9
|
# :date_uploaded (DC.dateSubmitted)
|
@@ -20,14 +20,12 @@ module GeoConcerns
|
|
20
20
|
@catalog ||= RGeoServer.catalog(config)
|
21
21
|
end
|
22
22
|
|
23
|
-
def publish
|
23
|
+
def publish
|
24
24
|
case type
|
25
25
|
when :vector
|
26
26
|
publish_vector
|
27
27
|
when :raster
|
28
28
|
publish_raster
|
29
|
-
else
|
30
|
-
raise ArgumentError, "Unknown file type #{type}"
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
@@ -51,6 +49,12 @@ module GeoConcerns
|
|
51
49
|
end
|
52
50
|
end
|
53
51
|
|
52
|
+
def type
|
53
|
+
return :vector if file_path =~ /\.zip$/
|
54
|
+
return :raster if file_path =~ /\.tif$/
|
55
|
+
raise ArgumentError, "Not a ZIPed Shapefile or GeoTIFF: #{file_path}"
|
56
|
+
end
|
57
|
+
|
54
58
|
def workspace
|
55
59
|
workspace = RGeoServer::Workspace.new catalog, name: workspace_name
|
56
60
|
workspace.save if workspace.new?
|
@@ -62,13 +66,15 @@ module GeoConcerns
|
|
62
66
|
end
|
63
67
|
|
64
68
|
def publish_vector
|
65
|
-
raise ArgumentError, "Not ZIPed Shapefile: #{file_path}" unless file_path =~ /\.zip$/
|
66
69
|
datastore.upload_file file_path, publish: true
|
67
70
|
end
|
68
71
|
|
72
|
+
def coveragestore
|
73
|
+
RGeoServer::CoverageStore.new catalog, workspace: workspace, name: file_set.id
|
74
|
+
end
|
75
|
+
|
69
76
|
def publish_raster
|
70
|
-
|
71
|
-
raise NotImplementedError
|
77
|
+
coveragestore.upload file_path
|
72
78
|
end
|
73
79
|
end
|
74
80
|
end
|
data/geo_concerns.gemspec
CHANGED
@@ -20,11 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 2.2.2' # same as Rails 5
|
22
22
|
|
23
|
-
spec.add_dependency 'curation_concerns', '1.
|
23
|
+
spec.add_dependency 'curation_concerns', '1.6.0'
|
24
24
|
spec.add_dependency 'leaflet-rails', '~> 0.7'
|
25
25
|
spec.add_dependency 'simple_mapnik', '0.1.2'
|
26
26
|
spec.add_dependency 'json-schema', '>= 2.6.2'
|
27
|
-
spec.add_dependency 'rgeoserver', '>= 0.
|
27
|
+
spec.add_dependency 'rgeoserver', '>= 0.10.0'
|
28
28
|
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bundler', '~> 1.13'
|
data/lib/geo_concerns/version.rb
CHANGED
data/run-docker.sh
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
docker-machine start
|
3
|
-
docker_ip=$(docker-machine ip)
|
4
3
|
eval $(docker-machine env)
|
5
4
|
docker-compose up -d
|
6
|
-
|
7
|
-
|
5
|
+
# forward geoserver ports in the background
|
6
|
+
docker-machine ssh default -f -N -L 8181:localhost:8181
|
@@ -28,35 +28,31 @@ describe GeoConcerns::Delivery::Geoserver do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe '#publish' do
|
31
|
-
it 'requires a valid type' do
|
32
|
-
expect { subject.publish(:unknown) }.to raise_error(ArgumentError, /Unknown file type/)
|
33
|
-
end
|
34
|
-
|
35
31
|
context 'when type is vector' do
|
36
|
-
let(:
|
32
|
+
let(:path) { 'spec/fixtures/files/tufts-cambridgegrid100-04.zip' }
|
37
33
|
it 'routes to publish_vector' do
|
38
34
|
expect(subject).to receive(:publish_vector)
|
39
|
-
subject.publish
|
35
|
+
subject.publish
|
40
36
|
end
|
41
37
|
end
|
42
38
|
|
43
39
|
context 'when type is raster' do
|
44
|
-
let(:
|
40
|
+
let(:path) { 'spec/fixtures/files/S_566_1914_clip.tif' }
|
45
41
|
it 'routes to publish_raster' do
|
46
42
|
expect(subject).to receive(:publish_raster)
|
47
|
-
subject.publish
|
43
|
+
subject.publish
|
48
44
|
end
|
49
45
|
end
|
50
|
-
end
|
51
46
|
|
52
|
-
|
53
|
-
|
54
|
-
let(:path) { 'not-a-zip' }
|
47
|
+
context 'when type is not a raster or vector' do
|
48
|
+
let(:path) { 'not-a-zip-or-tif' }
|
55
49
|
it 'raises an error' do
|
56
|
-
expect { subject.
|
50
|
+
expect { subject.publish }.to raise_error(ArgumentError, /Not a ZIPed Shapefile/)
|
57
51
|
end
|
58
52
|
end
|
53
|
+
end
|
59
54
|
|
55
|
+
describe '#publish_vector' do
|
60
56
|
context 'with a path to a zipped shapefile' do
|
61
57
|
let(:ws) { double }
|
62
58
|
let(:ds) { double }
|
@@ -74,16 +70,16 @@ describe GeoConcerns::Delivery::Geoserver do
|
|
74
70
|
|
75
71
|
describe '#publish_raster' do
|
76
72
|
let(:path) { 'spec/fixtures/files/S_566_1914_clip.tif' }
|
73
|
+
let(:ws) { double }
|
74
|
+
let(:cs) { double }
|
77
75
|
|
78
|
-
it '
|
79
|
-
expect
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
expect { subject.send(:publish_raster) }.to raise_error(ArgumentError, /Not GeoTIFF/)
|
86
|
-
end
|
76
|
+
it 'dispatches to RGeoServer' do
|
77
|
+
expect(RGeoServer::Workspace).to receive(:new).with(subject.catalog, hash_including(name: 'public')).and_return(ws)
|
78
|
+
expect(ws).to receive(:'new?').and_return(true)
|
79
|
+
expect(ws).to receive(:save)
|
80
|
+
expect(RGeoServer::CoverageStore).to receive(:new).with(subject.catalog, hash_including(workspace: ws, name: id)).and_return(cs)
|
81
|
+
expect(cs).to receive(:upload).with(path)
|
82
|
+
subject.send(:publish_raster)
|
87
83
|
end
|
88
84
|
end
|
89
85
|
|
data/tasks/geo_concerns.rake
CHANGED
data/template.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geo_concerns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Griffin
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-09-
|
15
|
+
date: 2016-09-16 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: curation_concerns
|
@@ -20,14 +20,14 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - '='
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
23
|
+
version: 1.6.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
28
|
- - '='
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 1.
|
30
|
+
version: 1.6.0
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: leaflet-rails
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,14 +76,14 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.
|
79
|
+
version: 0.10.0
|
80
80
|
type: :runtime
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
84
|
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: 0.
|
86
|
+
version: 0.10.0
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: bundler
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -467,7 +467,9 @@ files:
|
|
467
467
|
- app/views/geo_concerns/related/_parent_member.html.erb
|
468
468
|
- app/views/geo_concerns/related/_parent_works.html.erb
|
469
469
|
- app/vocabs/geo_concerns/geo_terms.rb
|
470
|
+
- config/fcrepo_wrapper_test.yml
|
470
471
|
- config/routes.rb
|
472
|
+
- config/solr_wrapper_test.yml
|
471
473
|
- docker-compose.yml
|
472
474
|
- geo_concerns.gemspec
|
473
475
|
- lib/generators/geo_concerns/install_generator.rb
|