geoserver-publish 0.2.1 → 0.3.0
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 +5 -5
- data/.travis.yml +2 -2
- data/README.md +3 -3
- data/geoserver-publish.gemspec +1 -1
- data/lib/geoserver/publish/connection.rb +11 -0
- data/lib/geoserver/publish/data_store.rb +10 -0
- data/lib/geoserver/publish/version.rb +1 -1
- metadata +13 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '038968f3cbde7d9a19944be64b05d0ff2d51b73d342b2828d80758389c3ee544'
|
4
|
+
data.tar.gz: 2876f56b1401b5f0108fce1a429b99e94c860c029ae8da417bcb429ba7d179ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8506a643df04755609e2d7b02063ccde7ee22db949dd5a868267a4d029273c04afd82e633a34db2db1578bfe916ba72e0cfaa67c1eed0b08829668a7a7d7c3b8
|
7
|
+
data.tar.gz: a73bc4fef84d232ea2463d32b0e747706e8048487ef5558254359e547f7feba0f95dbc0cd1761dc6e4318d347e5542380f4e6a6bc794c542215c752ffc4af3a6
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Geoserver::Publish
|
2
2
|
|
3
|
-
[](https://travis-ci.org/samvera-labs/geoserver-publish)
|
4
|
+
[](https://coveralls.io/github/samvera-labs/geoserver-publish?branch=master)
|
5
5
|
|
6
6
|
Simple client for publishing Shapefiles and GeoTIFFs to Geoserver.
|
7
7
|
|
@@ -78,4 +78,4 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
78
78
|
|
79
79
|
## Contributing
|
80
80
|
|
81
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
81
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/samvera-labs/geoserver-publish.
|
data/geoserver-publish.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.add_dependency "faraday"
|
27
27
|
|
28
|
-
spec.add_development_dependency "bundler", "
|
28
|
+
spec.add_development_dependency "bundler", "> 1.16.0", "< 3"
|
29
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
30
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
31
|
end
|
@@ -35,6 +35,17 @@ module Geoserver
|
|
35
35
|
raise Geoserver::Publish::Error, response.reason_phrase
|
36
36
|
end
|
37
37
|
|
38
|
+
def put(path:, payload:, content_type:)
|
39
|
+
response = faraday_connection.put do |req|
|
40
|
+
req.url path
|
41
|
+
req.headers['Content-Type'] = content_type
|
42
|
+
req.body = payload
|
43
|
+
end
|
44
|
+
return true if response.status == 201 || response.status == 200
|
45
|
+
|
46
|
+
raise Geoserver::Publish::Error, response.reason_phrase
|
47
|
+
end
|
48
|
+
|
38
49
|
private
|
39
50
|
|
40
51
|
def faraday_connection
|
@@ -25,6 +25,12 @@ module Geoserver
|
|
25
25
|
connection.post(path: path, payload: payload)
|
26
26
|
end
|
27
27
|
|
28
|
+
def upload(workspace_name:, data_store_name:, file:)
|
29
|
+
content_type = 'application/zip'
|
30
|
+
path = upload_url(workspace: workspace_name, data_store: data_store_name)
|
31
|
+
connection.put(path: path, payload: file, content_type: content_type)
|
32
|
+
end
|
33
|
+
|
28
34
|
private
|
29
35
|
|
30
36
|
def data_store_url(workspace_name:, data_store_name:)
|
@@ -32,6 +38,10 @@ module Geoserver
|
|
32
38
|
"workspaces/#{workspace_name}/datastores#{last_path_component}"
|
33
39
|
end
|
34
40
|
|
41
|
+
def upload_url(workspace:, data_store:)
|
42
|
+
"workspaces/#{workspace}/datastores/#{data_store}/file.shp"
|
43
|
+
end
|
44
|
+
|
35
45
|
# rubocop:disable Metrics/MethodLength
|
36
46
|
def payload_new(data_store_name:, url:)
|
37
47
|
{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geoserver-publish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eliot Jordan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -28,16 +28,22 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.16.0
|
34
|
+
- - "<"
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
36
|
+
version: '3'
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.16.0
|
44
|
+
- - "<"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '3'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rake
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
120
|
- !ruby/object:Gem::Version
|
115
121
|
version: '0'
|
116
122
|
requirements: []
|
117
|
-
|
118
|
-
rubygems_version: 2.4.5
|
123
|
+
rubygems_version: 3.0.3
|
119
124
|
signing_key:
|
120
125
|
specification_version: 4
|
121
126
|
summary: Simple client for publishing Shapefiles and GeoTIFFs to Geoserver
|