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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4d296ac0e14cade1f18b5ec69777195e2375c79429f3f1f33ca9324353204a4
4
- data.tar.gz: 3d71450e0be590e67ceb2e100cff4f80499311db14614d887381d1347efc043d
3
+ metadata.gz: f3ad5cea5658a61dfea5760e6c877f6e21502e354c3e871d13fc17d50e51b02c
4
+ data.tar.gz: ed767aa60e5f578381f1d224b13b1518e910188b15734f545e8c4547d52881e2
5
5
  SHA512:
6
- metadata.gz: 235d515c044502a24fa82d1519b407dfa9b0bb956f54ccae768cd9ebd5b011348436bb89e68fe2251a3b50adf5c1d614fae2819ef10176009cbacb73d3d9f94e
7
- data.tar.gz: fdbe59744fa57f637534c44a0fc4b8618f28fe7104ed219e651046309d92fe14ec4f9ea28e54390ee680290d2dd2d45a994d500e96f190e7389ee5ced681af79
6
+ metadata.gz: 0d2b681cfeaa1504af13969ce464e957eed4287dd0c57ab8ffeb7391bc03f48f905c86d79498c07e7dee1a58a115ca158ecc57a75fa0a18c98bb1d17d2d33dc4
7
+ data.tar.gz: 815c2c1c460981afd7f933e7fad6d80c3d4782106b8f953b4ebf80c5381a821e9d7cc3cf37229c101ab1329a446adf53d837082c9fefac3c588d1711e24f8175
@@ -10,7 +10,7 @@ jobs:
10
10
  - name: Set up Ruby
11
11
  uses: ruby/setup-ruby@v1
12
12
  with:
13
- ruby-version: 2.7
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: 2.7
27
+ ruby-version: 3.3
28
28
 
29
29
  - name: Install bundler
30
- run: gem install bundler -v 2.1.1
30
+ run: gem install bundler
31
31
 
32
32
  - name: Install dependencies
33
- run: bundle _2.1.1_ install
33
+ run: bundle install
34
34
 
35
35
  - name: Run tests
36
- run: bundle exec rake spec
36
+ run: bundle exec rspec
37
37
 
38
38
  - name: Upload coverage artifacts
39
39
  uses: actions/upload-artifact@v2
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  .rspec_status
11
11
  .tool-versions
12
12
  Gemfile.lock
13
+ *.gem
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.4
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,7 +7,6 @@ gemspec
7
7
 
8
8
  group :development, :test do
9
9
  gem "bixby", require: false
10
- gem "coveralls", require: false
11
10
  gem "simplecov", require: false
12
11
  end
13
12
 
@@ -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
- YAML.safe_load(ERB.new(File.read(file_path)).result, [], [], true)
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: {
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Geoserver
3
3
  module Publish
4
- VERSION = "0.6.0"
4
+ VERSION = "1.0.0"
5
5
  end
6
6
  end
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.6.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: 2022-02-09 00:00:00.000000000 Z
11
+ date: 2024-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday