geoserver-publish 0.6.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -2
- data/Gemfile +0 -1
- data/lib/geoserver/publish/config.rb +8 -1
- data/lib/geoserver/publish/coverage_store.rb +35 -0
- data/lib/geoserver/publish/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3ad5cea5658a61dfea5760e6c877f6e21502e354c3e871d13fc17d50e51b02c
|
4
|
+
data.tar.gz: ed767aa60e5f578381f1d224b13b1518e910188b15734f545e8c4547d52881e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d2b681cfeaa1504af13969ce464e957eed4287dd0c57ab8ffeb7391bc03f48f905c86d79498c07e7dee1a58a115ca158ecc57a75fa0a18c98bb1d17d2d33dc4
|
7
|
+
data.tar.gz: 815c2c1c460981afd7f933e7fad6d80c3d4782106b8f953b4ebf80c5381a821e9d7cc3cf37229c101ab1329a446adf53d837082c9fefac3c588d1711e24f8175
|
data/.github/workflows/ruby.yml
CHANGED
@@ -10,7 +10,7 @@ jobs:
|
|
10
10
|
- name: Set up Ruby
|
11
11
|
uses: ruby/setup-ruby@v1
|
12
12
|
with:
|
13
|
-
ruby-version:
|
13
|
+
ruby-version: 3.3
|
14
14
|
- name: Install dependencies
|
15
15
|
run: bundle install
|
16
16
|
- name: Run linter
|
@@ -24,16 +24,16 @@ jobs:
|
|
24
24
|
- name: Set up Ruby
|
25
25
|
uses: ruby/setup-ruby@v1
|
26
26
|
with:
|
27
|
-
ruby-version:
|
27
|
+
ruby-version: 3.3
|
28
28
|
|
29
29
|
- name: Install bundler
|
30
|
-
run: gem install bundler
|
30
|
+
run: gem install bundler
|
31
31
|
|
32
32
|
- name: Install dependencies
|
33
|
-
run: bundle
|
33
|
+
run: bundle install
|
34
34
|
|
35
35
|
- name: Run tests
|
36
|
-
run: bundle exec
|
36
|
+
run: bundle exec rspec
|
37
37
|
|
38
38
|
- name: Upload coverage artifacts
|
39
39
|
uses: actions/upload-artifact@v2
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -2,7 +2,7 @@ inherit_gem:
|
|
2
2
|
bixby: bixby_default.yml
|
3
3
|
AllCops:
|
4
4
|
DisplayCopNames: true
|
5
|
-
TargetRubyVersion: 2.
|
5
|
+
TargetRubyVersion: 2.7
|
6
6
|
Exclude:
|
7
7
|
- 'bin/*'
|
8
8
|
Lint/UnusedMethodArgument:
|
@@ -13,7 +13,7 @@ Metrics/BlockLength:
|
|
13
13
|
- "spec/**/*"
|
14
14
|
- "*.gemspec"
|
15
15
|
Naming/FileName:
|
16
|
-
Exclude:
|
16
|
+
Exclude:
|
17
17
|
- "geoserver-publish.gemspec"
|
18
18
|
- "Gemfile"
|
19
19
|
Style/StringLiterals:
|
data/Gemfile
CHANGED
@@ -7,10 +7,17 @@ module Geoserver
|
|
7
7
|
|
8
8
|
private
|
9
9
|
|
10
|
+
# :nocov:
|
10
11
|
def config_yaml
|
11
12
|
file_path = File.join(Geoserver::Publish.root, "config", "config.yml")
|
12
|
-
|
13
|
+
yaml_text = ERB.new(File.read(file_path)).result
|
14
|
+
if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0.pre1")
|
15
|
+
YAML.safe_load(yaml_text, aliases: true)
|
16
|
+
else
|
17
|
+
YAML.safe_load(yaml_text, [], [], true)
|
18
|
+
end
|
13
19
|
end
|
20
|
+
# :nocov:
|
14
21
|
|
15
22
|
module_function :config, :config_yaml
|
16
23
|
end
|
@@ -31,6 +31,35 @@ module Geoserver
|
|
31
31
|
connection.put(path: path, payload: payload, content_type: "application/json")
|
32
32
|
end
|
33
33
|
|
34
|
+
##
|
35
|
+
# Upload raster data files to a new coverage store
|
36
|
+
# # @param workspace_name [String]
|
37
|
+
# # @param coverage_store_name [String]
|
38
|
+
# # @param format [String] One of:
|
39
|
+
# geotiff == GeoTIFF
|
40
|
+
# worldimage == Georeferenced image (JPEG, PNG, TIFF)
|
41
|
+
# imagemosaic == Image mosaic
|
42
|
+
# See: https://docs.geoserver.org/stable/en/user/rest/api/coveragestores.html#extension
|
43
|
+
# # @param file [String] Depending on value of method:
|
44
|
+
# file == binary stream
|
45
|
+
# url == URL to publicly available raster files (DOESN'T ACTUALLY WORK).
|
46
|
+
# external == absolute path to existing file
|
47
|
+
# # @param content_type [String] Content-Type for file upload
|
48
|
+
# # @param method [String] Can be one of 'file', 'url', 'external'.
|
49
|
+
# See: https://docs.geoserver.org/latest/en/api/#1.0.0/coveragestores.yaml
|
50
|
+
# rubocop:disable Metrics/ParameterLists
|
51
|
+
def upload(workspace_name:, coverage_store_name:, format:, file:, method: "file", content_type: "application/zip")
|
52
|
+
path = upload_url(
|
53
|
+
workspace_name: workspace_name,
|
54
|
+
coverage_store_name: coverage_store_name,
|
55
|
+
method: method,
|
56
|
+
format: format
|
57
|
+
)
|
58
|
+
|
59
|
+
connection.put(path: path, payload: file, content_type: content_type)
|
60
|
+
end
|
61
|
+
# rubocop:enable Metrics/ParameterLists
|
62
|
+
|
34
63
|
private
|
35
64
|
|
36
65
|
def coverage_store_url(workspace_name:, coverage_store_name:)
|
@@ -38,6 +67,12 @@ module Geoserver
|
|
38
67
|
"workspaces/#{workspace_name}/coveragestores#{last_path_component}"
|
39
68
|
end
|
40
69
|
|
70
|
+
# see: https://docs.geoserver.org/latest/en/api/#1.0.0/coveragestores.yaml
|
71
|
+
# /workspaces/{workspace}/coveragestores/{store}/{method}.{format}
|
72
|
+
def upload_url(workspace_name:, coverage_store_name:, method:, format:)
|
73
|
+
"workspaces/#{workspace_name}/coveragestores/#{coverage_store_name}/#{method}.#{format}?coverageName=#{coverage_store_name}"
|
74
|
+
end
|
75
|
+
|
41
76
|
def payload_new(workspace_name:, coverage_store_name:, type:, url:, payload:)
|
42
77
|
{
|
43
78
|
coverageStore: {
|
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: 1.0.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: 2024-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|