skull_island 2.0.5 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +16 -3
- data/.travis.yml +3 -3
- data/Dockerfile +1 -1
- data/Gemfile.lock +65 -59
- data/README.md +27 -9
- data/lib/skull_island.rb +1 -1
- data/lib/skull_island/cli.rb +10 -6
- data/lib/skull_island/helpers/meta.rb +1 -1
- data/lib/skull_island/helpers/resource.rb +16 -7
- data/lib/skull_island/lru_cache.rb +1 -1
- data/lib/skull_island/resource.rb +4 -3
- data/lib/skull_island/resource_collection.rb +4 -3
- data/lib/skull_island/resources/ca_certificate.rb +29 -3
- data/lib/skull_island/resources/certificate.rb +29 -5
- data/lib/skull_island/resources/consumer.rb +6 -3
- data/lib/skull_island/resources/jwt_credential.rb +2 -0
- data/lib/skull_island/resources/plugin.rb +20 -12
- data/lib/skull_island/resources/route.rb +4 -0
- data/lib/skull_island/resources/service.rb +70 -3
- data/lib/skull_island/resources/upstream_target.rb +4 -3
- data/lib/skull_island/validations/api_client.rb +1 -1
- data/lib/skull_island/validations/resource.rb +1 -1
- data/lib/skull_island/version.rb +2 -2
- data/skull_island.gemspec +6 -6
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89b4839743cdb5d8a7c638534b00bc82ec2dbb524e77254218c3856ae566fa17
|
4
|
+
data.tar.gz: 471e753713fcb52e7151d90ea58afdbb8d62b8d4b90dcbf7d0de575ba5e91b3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d49ed90d48abdd81314d3bc131d6c69d629a088937a0b1680fbd5701959fd10f422687376482e7aaf530071e2baf1b0986d9faa6ecb29b037512569793427b7
|
7
|
+
data.tar.gz: 60f5768b190f96bf5e436a15a2d19c3b55f29f9a0ffceb6707da17f3404b34f3e3c5412477ce0cdfac4ec1a50f18f1d04d2cdf739bc670a0484e52e20745f112
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion:
|
2
|
+
TargetRubyVersion: 3.0
|
3
|
+
NewCops: enable
|
3
4
|
|
4
5
|
Metrics/MethodLength:
|
5
6
|
Max: 50
|
@@ -13,6 +14,14 @@ Layout/LineLength:
|
|
13
14
|
Layout/SpaceAroundMethodCallOperator:
|
14
15
|
Enabled: true
|
15
16
|
|
17
|
+
Lint/ConstantDefinitionInBlock:
|
18
|
+
Exclude:
|
19
|
+
- 'spec/**/*_spec.rb'
|
20
|
+
- 'spec/spec_helper.rb'
|
21
|
+
|
22
|
+
Lint/MissingSuper:
|
23
|
+
Enabled: false
|
24
|
+
|
16
25
|
Lint/RaiseException:
|
17
26
|
Enabled: true
|
18
27
|
|
@@ -20,7 +29,7 @@ Lint/StructNewOverride:
|
|
20
29
|
Enabled: true
|
21
30
|
|
22
31
|
Metrics/ClassLength:
|
23
|
-
Max:
|
32
|
+
Max: 200
|
24
33
|
|
25
34
|
Metrics/ModuleLength:
|
26
35
|
Max: 175
|
@@ -28,12 +37,13 @@ Metrics/ModuleLength:
|
|
28
37
|
- 'lib/skull_island/helpers/resource.rb'
|
29
38
|
|
30
39
|
Metrics/CyclomaticComplexity:
|
31
|
-
Max:
|
40
|
+
Max: 8
|
32
41
|
|
33
42
|
Metrics/ParameterLists:
|
34
43
|
Max: 6
|
35
44
|
|
36
45
|
Metrics/PerceivedComplexity:
|
46
|
+
Max: 8
|
37
47
|
Exclude:
|
38
48
|
- 'lib/skull_island/cli.rb'
|
39
49
|
|
@@ -71,5 +81,8 @@ Style/NumericLiterals:
|
|
71
81
|
Exclude:
|
72
82
|
- 'spec/**/*_spec.rb'
|
73
83
|
|
84
|
+
Style/OptionalBooleanParameter:
|
85
|
+
Enabled: false
|
86
|
+
|
74
87
|
Style/SlicingWithRange:
|
75
88
|
Enabled: true
|
data/.travis.yml
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
language: ruby
|
2
2
|
cache: bundler
|
3
3
|
rvm:
|
4
|
-
-
|
5
|
-
- 2.
|
6
|
-
before_install: gem install bundler -v 2.0.1
|
4
|
+
- 3.0
|
5
|
+
before_install: gem install bundler -v '~> 2.2'
|
7
6
|
deploy:
|
8
7
|
provider: rubygems
|
9
8
|
api_key:
|
@@ -11,4 +10,5 @@ deploy:
|
|
11
10
|
gem: skull_island
|
12
11
|
on:
|
13
12
|
tags: true
|
13
|
+
rvm: 3.0
|
14
14
|
repo: jgnagy/skull_island
|
data/Dockerfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,47 +1,46 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
skull_island (2.
|
4
|
+
skull_island (2.3.1)
|
5
5
|
deepsort (~> 0.4)
|
6
6
|
erubi (~> 1.8)
|
7
|
-
json (~> 2.1)
|
8
7
|
linguistics (~> 2.1)
|
9
8
|
rest-client (~> 2.1)
|
10
|
-
thor (~> 0
|
9
|
+
thor (~> 1.0)
|
11
10
|
will_paginate (~> 3.1)
|
11
|
+
yajl-ruby (~> 1.4)
|
12
12
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
activesupport (5.2.4.
|
16
|
+
activesupport (5.2.4.5)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 0.7, < 2)
|
19
19
|
minitest (~> 5.1)
|
20
20
|
tzinfo (~> 1.1)
|
21
21
|
addressable (2.7.0)
|
22
22
|
public_suffix (>= 2.0.2, < 5.0)
|
23
|
-
ast (2.4.
|
24
|
-
concurrent-ruby (1.1.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
thor
|
23
|
+
ast (2.4.2)
|
24
|
+
concurrent-ruby (1.1.8)
|
25
|
+
coveralls_reborn (0.20.0)
|
26
|
+
simplecov (>= 0.18.1, < 0.22.0)
|
27
|
+
term-ansicolor (~> 1.6)
|
28
|
+
thor (>= 0.20.3, < 2.0)
|
29
|
+
tins (~> 1.16)
|
31
30
|
deepsort (0.4.5)
|
32
|
-
diff-lcs (1.
|
33
|
-
docile (1.3.
|
31
|
+
diff-lcs (1.4.4)
|
32
|
+
docile (1.3.5)
|
34
33
|
domain_name (0.5.20190701)
|
35
34
|
unf (>= 0.0.5, < 1.0.0)
|
36
35
|
erubi (1.10.0)
|
37
|
-
|
38
|
-
|
39
|
-
faraday (1.0.1)
|
36
|
+
faraday (1.3.0)
|
37
|
+
faraday-net_http (~> 1.0)
|
40
38
|
multipart-post (>= 1.2, < 3)
|
39
|
+
ruby2_keywords
|
40
|
+
faraday-net_http (1.0.1)
|
41
41
|
faraday_middleware (1.0.0)
|
42
42
|
faraday (~> 1.0)
|
43
|
-
|
44
|
-
gh (0.17.0)
|
43
|
+
gh (0.18.0)
|
45
44
|
activesupport (~> 5.0)
|
46
45
|
addressable (~> 2.4)
|
47
46
|
faraday (~> 1.0)
|
@@ -53,104 +52,111 @@ GEM
|
|
53
52
|
http-accept (1.7.0)
|
54
53
|
http-cookie (1.0.3)
|
55
54
|
domain_name (~> 0.5)
|
56
|
-
i18n (1.8.
|
55
|
+
i18n (1.8.9)
|
57
56
|
concurrent-ruby (~> 1.0)
|
58
|
-
json (2.
|
57
|
+
json (2.5.1)
|
58
|
+
json_pure (2.5.1)
|
59
59
|
launchy (2.4.3)
|
60
60
|
addressable (~> 2.3)
|
61
61
|
linguistics (2.1.0)
|
62
62
|
loggability (~> 0.11)
|
63
|
-
loggability (0.
|
63
|
+
loggability (0.18.2)
|
64
64
|
mime-types (3.3.1)
|
65
65
|
mime-types-data (~> 3.2015)
|
66
|
-
mime-types-data (3.
|
67
|
-
minitest (5.14.
|
68
|
-
multi_json (1.
|
66
|
+
mime-types-data (3.2021.0212)
|
67
|
+
minitest (5.14.3)
|
68
|
+
multi_json (1.15.0)
|
69
69
|
multipart-post (2.1.1)
|
70
70
|
net-http-persistent (2.9.4)
|
71
71
|
net-http-pipeline (1.0.1)
|
72
72
|
netrc (0.11.0)
|
73
|
-
parallel (1.
|
74
|
-
parser (
|
75
|
-
ast (~> 2.4.
|
76
|
-
public_suffix (4.0.
|
73
|
+
parallel (1.20.1)
|
74
|
+
parser (3.0.0.0)
|
75
|
+
ast (~> 2.4.1)
|
76
|
+
public_suffix (4.0.6)
|
77
77
|
pusher-client (0.6.2)
|
78
78
|
json
|
79
79
|
websocket (~> 1.0)
|
80
80
|
rainbow (3.0.0)
|
81
|
-
rake (13.0.
|
81
|
+
rake (13.0.3)
|
82
|
+
regexp_parser (2.0.3)
|
82
83
|
rest-client (2.1.0)
|
83
84
|
http-accept (>= 1.7.0, < 2.0)
|
84
85
|
http-cookie (>= 1.0.2, < 2.0)
|
85
86
|
mime-types (>= 1.16, < 4.0)
|
86
87
|
netrc (~> 0.8)
|
87
88
|
rexml (3.2.4)
|
88
|
-
rspec (3.
|
89
|
-
rspec-core (~> 3.
|
90
|
-
rspec-expectations (~> 3.
|
91
|
-
rspec-mocks (~> 3.
|
92
|
-
rspec-core (3.
|
93
|
-
rspec-support (~> 3.
|
94
|
-
rspec-expectations (3.
|
89
|
+
rspec (3.10.0)
|
90
|
+
rspec-core (~> 3.10.0)
|
91
|
+
rspec-expectations (~> 3.10.0)
|
92
|
+
rspec-mocks (~> 3.10.0)
|
93
|
+
rspec-core (3.10.1)
|
94
|
+
rspec-support (~> 3.10.0)
|
95
|
+
rspec-expectations (3.10.1)
|
95
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
96
|
-
rspec-support (~> 3.
|
97
|
-
rspec-mocks (3.
|
97
|
+
rspec-support (~> 3.10.0)
|
98
|
+
rspec-mocks (3.10.2)
|
98
99
|
diff-lcs (>= 1.2.0, < 2.0)
|
99
|
-
rspec-support (~> 3.
|
100
|
-
rspec-support (3.
|
101
|
-
rubocop (0.
|
100
|
+
rspec-support (~> 3.10.0)
|
101
|
+
rspec-support (3.10.2)
|
102
|
+
rubocop (0.93.1)
|
102
103
|
parallel (~> 1.10)
|
103
|
-
parser (>= 2.7.
|
104
|
+
parser (>= 2.7.1.5)
|
104
105
|
rainbow (>= 2.2.2, < 4.0)
|
106
|
+
regexp_parser (>= 1.8)
|
105
107
|
rexml
|
108
|
+
rubocop-ast (>= 0.6.0)
|
106
109
|
ruby-progressbar (~> 1.7)
|
107
110
|
unicode-display_width (>= 1.4.0, < 2.0)
|
108
|
-
|
109
|
-
|
111
|
+
rubocop-ast (1.4.1)
|
112
|
+
parser (>= 2.7.1.5)
|
113
|
+
ruby-progressbar (1.11.0)
|
114
|
+
ruby2_keywords (0.0.4)
|
115
|
+
simplecov (0.21.2)
|
110
116
|
docile (~> 1.1)
|
111
117
|
simplecov-html (~> 0.11)
|
112
|
-
|
118
|
+
simplecov_json_formatter (~> 0.1)
|
119
|
+
simplecov-html (0.12.3)
|
120
|
+
simplecov_json_formatter (0.1.2)
|
113
121
|
sync (0.5.0)
|
114
122
|
term-ansicolor (1.7.1)
|
115
123
|
tins (~> 1.0)
|
116
|
-
thor (
|
124
|
+
thor (1.1.0)
|
117
125
|
thread_safe (0.3.6)
|
118
|
-
tins (1.
|
126
|
+
tins (1.28.0)
|
119
127
|
sync
|
120
|
-
travis (1.
|
128
|
+
travis (1.10.0)
|
121
129
|
faraday (~> 1.0)
|
122
130
|
faraday_middleware (~> 1.0)
|
123
131
|
gh (~> 0.13)
|
124
132
|
highline (~> 2.0)
|
125
|
-
|
133
|
+
json_pure (~> 2.3)
|
126
134
|
launchy (~> 2.1, < 2.5.0)
|
127
135
|
pusher-client (~> 0.4)
|
128
|
-
|
129
|
-
typhoeus (0.8.0)
|
130
|
-
ethon (>= 0.8.0)
|
131
|
-
tzinfo (1.2.7)
|
136
|
+
tzinfo (1.2.9)
|
132
137
|
thread_safe (~> 0.1)
|
133
138
|
unf (0.1.4)
|
134
139
|
unf_ext
|
135
140
|
unf_ext (0.0.7.7)
|
136
141
|
unicode-display_width (1.7.0)
|
137
|
-
websocket (1.2.
|
142
|
+
websocket (1.2.9)
|
138
143
|
will_paginate (3.3.0)
|
139
|
-
|
144
|
+
yajl-ruby (1.4.1)
|
145
|
+
yard (0.9.26)
|
140
146
|
|
141
147
|
PLATFORMS
|
142
148
|
ruby
|
143
149
|
|
144
150
|
DEPENDENCIES
|
145
151
|
bundler (~> 2.0)
|
146
|
-
|
152
|
+
coveralls_reborn (~> 0.20)
|
147
153
|
rake (~> 13.0)
|
148
154
|
rspec (~> 3.0)
|
149
155
|
rubocop (~> 0.50)
|
150
|
-
simplecov (~> 0.
|
156
|
+
simplecov (~> 0.21)
|
151
157
|
skull_island!
|
152
158
|
travis (~> 1.8)
|
153
159
|
yard (~> 0.9.20)
|
154
160
|
|
155
161
|
BUNDLED WITH
|
156
|
-
2.
|
162
|
+
2.2.10
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Skull Island
|
2
2
|
|
3
|
-
A full-featured SDK for [Kong](https://konghq.com/kong/) 2.
|
3
|
+
A full-featured SDK for [Kong](https://konghq.com/kong/) 2.3.x (with support 2.0.x, 2.1.x, and 2.2.x, and for migrating from 0.14.x, 1.1.x, 1.2.x, 1.4.x, and 1.5.x). Note that this is unofficial (meaning this project is in no way officially endorsed, recommended, or related to Kong [as a company](https://konghq.com/) or an [open-source project](https://github.com/Kong/kong)). It is also in no way related to the [pet toy company](https://www.kongcompany.com/) by the same name (but hopefully that was obvious).
|
4
4
|
|
5
5
|
![Gem](https://img.shields.io/gem/v/skull_island)
|
6
6
|
![Travis (.org)](https://img.shields.io/travis/jgnagy/skull_island)
|
@@ -21,7 +21,9 @@ skull_island help
|
|
21
21
|
|
22
22
|
### Ruby Gem Install / SDK
|
23
23
|
|
24
|
-
|
24
|
+
**Note:** Starting with 2.3.0, Skull Island only supports Ruby 3.0+. If you need to use Ruby 2.x, you'll need to use a gem version < 2.3.0. I'll maintain the 2.2.x line for Ruby 2.x compatibility for 2021.
|
25
|
+
|
26
|
+
To use the Skull Island gem, either:
|
25
27
|
|
26
28
|
```sh
|
27
29
|
gem install skull_island
|
@@ -30,7 +32,7 @@ gem install skull_island
|
|
30
32
|
Or add this to your Gemfile:
|
31
33
|
|
32
34
|
```ruby
|
33
|
-
gem 'skull_island', '~> 2.
|
35
|
+
gem 'skull_island', '~> 2.3'
|
34
36
|
```
|
35
37
|
|
36
38
|
Or add this to your .gemspec:
|
@@ -38,7 +40,7 @@ Or add this to your .gemspec:
|
|
38
40
|
```ruby
|
39
41
|
Gem::Specification.new do |spec|
|
40
42
|
# ...
|
41
|
-
spec.add_runtime_dependency 'skull_island', '~> 2.
|
43
|
+
spec.add_runtime_dependency 'skull_island', '~> 2.3'
|
42
44
|
# ...
|
43
45
|
end
|
44
46
|
```
|
@@ -149,7 +151,7 @@ When using the `project` feature of Skull Island, the CLI tool will automaticall
|
|
149
151
|
|
150
152
|
### Migrating
|
151
153
|
|
152
|
-
With Skull Island, it is possible to migrate a configuration from a 0.14.x, 1.1.x, 1.2.x, 1.4.x, or 1.5.x gateway to the most recent compatible gateway. If you have a previous export, you can just run `skull_island migrate /path/to/export.yml` and you'll receive a 2.
|
154
|
+
With Skull Island, it is possible to migrate a configuration from a 0.14.x, 1.1.x, 1.2.x, 1.4.x, or 1.5.x gateway to the most recent compatible gateway. If you have a previous export, you can just run `skull_island migrate /path/to/export.yml` and you'll receive a 2.3 compatible config on standard out. If you'd prefer, you can have that config written to a file as well (just like the export command) like so:
|
153
155
|
|
154
156
|
```sh
|
155
157
|
skull_island migrate /path/to/export.yml /output/location/migrated.yml
|
@@ -159,7 +161,7 @@ While this hasn't been heavily tested for all possible use-cases, any configurat
|
|
159
161
|
|
160
162
|
If you don't have a previous export, you'll need to install an older version of this gem using something like `gem install --version '~> 0.14' skull_island`, then perform an `export`, then you can switch back to the latest version of the gem for migrating and importing.
|
161
163
|
|
162
|
-
While it would be possible to make migration _automatic_ for the `import` command, `skull_island` intentionally doesn't do this to avoid the appearance that the config is losslessly compatible across versions. In reality, the newer config version has additional features (like tagging) that are used heavily by skull_island. It makes sense to this author to maintain the migration component and the normal functionality as distinct features to encourage the use of the newer capabilities in 1.1 and beyond. That said, Skull Island does allow 1.
|
164
|
+
While it would be possible to make migration _automatic_ for the `import` command, `skull_island` intentionally doesn't do this to avoid the appearance that the config is losslessly compatible across versions. In reality, the newer config version has additional features (like tagging) that are used heavily by skull_island. It makes sense to this author to maintain the migration component and the normal functionality as distinct features to encourage the use of the newer capabilities in 1.1 and beyond. That said, Skull Island does allow 1.x, 2.0.x, 2.1.x, and 2.2.x version configurations to be applied to 2.3 gateways, but not the opposite.
|
163
165
|
|
164
166
|
### Reset A Gateway
|
165
167
|
|
@@ -188,7 +190,7 @@ If you're wondering what version of `skull_island` is installed, use:
|
|
188
190
|
```sh
|
189
191
|
$ skull_island version
|
190
192
|
|
191
|
-
SkullIsland Version: 2.
|
193
|
+
SkullIsland Version: 2.3.0
|
192
194
|
```
|
193
195
|
|
194
196
|
### File Format
|
@@ -197,7 +199,7 @@ The import/export/migrate CLI functions produce YAML with support for embedded R
|
|
197
199
|
|
198
200
|
```yaml
|
199
201
|
---
|
200
|
-
version: '2.
|
202
|
+
version: '2.3'
|
201
203
|
project: FooV2
|
202
204
|
certificates: []
|
203
205
|
ca_certificates:
|
@@ -398,7 +400,7 @@ service.routes.size
|
|
398
400
|
# => 4
|
399
401
|
```
|
400
402
|
|
401
|
-
From here, the SDK mostly wraps the attributes described in the [Kong API Docs](https://docs.konghq.com/2.
|
403
|
+
From here, the SDK mostly wraps the attributes described in the [Kong API Docs](https://docs.konghq.com/2.3.x/admin-api/). For simplicity, I'll go over the resource types and attributes this SDK supports manipulating. Rely on the API documentation to determine which attributes are required and under which conditions.
|
402
404
|
|
403
405
|
#### CA Certificates
|
404
406
|
|
@@ -419,6 +421,14 @@ resource.created_at
|
|
419
421
|
# => #<DateTime: 2018-07-17T12:51:28+00:00 ((2458317j,46288s,0n),+0s,2299161j)>
|
420
422
|
```
|
421
423
|
|
424
|
+
Skull Island includes support for adding a _virtual_ `name` attribute to CA Certificates (useful for maintaining them over time) based on a metadata tag that Skull Island will manage for you:
|
425
|
+
|
426
|
+
```ruby
|
427
|
+
resource.name = 'internalca'
|
428
|
+
resource.name
|
429
|
+
# => "internalca"
|
430
|
+
```
|
431
|
+
|
422
432
|
#### Certificates
|
423
433
|
|
424
434
|
```ruby
|
@@ -438,6 +448,14 @@ resource.created_at
|
|
438
448
|
# => #<DateTime: 2018-07-17T12:51:28+00:00 ((2458317j,46288s,0n),+0s,2299161j)>
|
439
449
|
```
|
440
450
|
|
451
|
+
Skull Island includes support for adding a _virtual_ `name` attribute to Certificates (useful for maintaining them over time) based on a metadata tag that Skull Island will manage for you:
|
452
|
+
|
453
|
+
```ruby
|
454
|
+
resource.name = 'apicert'
|
455
|
+
resource.name
|
456
|
+
# => "apicert"
|
457
|
+
```
|
458
|
+
|
441
459
|
#### Consumers (along with their Access Control Lists and Credentials)
|
442
460
|
|
443
461
|
Note that for Consumer credentials, only [`key-auth`](https://docs.konghq.com/hub/kong-inc/key-auth/), [`jwt`](https://docs.konghq.com/hub/kong-inc/jwt/), and [`basic-auth`](https://docs.konghq.com/hub/kong-inc/basic-auth/) are currently supported.
|
data/lib/skull_island.rb
CHANGED
@@ -9,7 +9,6 @@ Hash.include CoreExtensions::Hash::Pruning
|
|
9
9
|
# Standard Library Requirements
|
10
10
|
require 'date'
|
11
11
|
require 'digest'
|
12
|
-
require 'json'
|
13
12
|
require 'singleton'
|
14
13
|
require 'uri'
|
15
14
|
require 'yaml'
|
@@ -22,6 +21,7 @@ Linguistics.use(:en)
|
|
22
21
|
require 'rest-client'
|
23
22
|
require 'will_paginate'
|
24
23
|
require 'will_paginate/array'
|
24
|
+
require 'yajl/json_gem'
|
25
25
|
|
26
26
|
# Internal Requirements
|
27
27
|
require 'skull_island/version'
|
data/lib/skull_island/cli.rb
CHANGED
@@ -30,7 +30,7 @@ module SkullIsland
|
|
30
30
|
|
31
31
|
validate_server_version
|
32
32
|
|
33
|
-
output = { 'version' => '2.
|
33
|
+
output = { 'version' => '2.3' }
|
34
34
|
output['project'] = options['project'] if options['project']
|
35
35
|
|
36
36
|
[
|
@@ -43,7 +43,7 @@ module SkullIsland
|
|
43
43
|
].each { |clname| export_class(clname, output) }
|
44
44
|
|
45
45
|
if output_file == '-'
|
46
|
-
|
46
|
+
$stdout.puts output.to_yaml
|
47
47
|
else
|
48
48
|
File.write(full_filename, output.to_yaml)
|
49
49
|
end
|
@@ -96,7 +96,7 @@ module SkullIsland
|
|
96
96
|
|
97
97
|
if output_file == '-'
|
98
98
|
warn '[INFO] Outputting to STDOUT' if options['verbose']
|
99
|
-
|
99
|
+
$stdout.puts output.to_yaml
|
100
100
|
else
|
101
101
|
full_filename = File.expand_path(output_file)
|
102
102
|
dirname = File.dirname(full_filename)
|
@@ -175,7 +175,7 @@ module SkullIsland
|
|
175
175
|
def acquire_input(input_file, verbose = false)
|
176
176
|
if input_file == '-'
|
177
177
|
warn '[INFO] Reading from STDIN' if verbose
|
178
|
-
|
178
|
+
$stdin.read
|
179
179
|
else
|
180
180
|
full_filename = File.expand_path(input_file)
|
181
181
|
unless File.exist?(full_filename) && File.ftype(full_filename) == 'file'
|
@@ -191,7 +191,7 @@ module SkullIsland
|
|
191
191
|
end
|
192
192
|
|
193
193
|
def validate_config_version(version)
|
194
|
-
if version && ['1.1', '1.2', '1.4', '1.5', '2.0'].include?(version)
|
194
|
+
if version && ['1.1', '1.2', '1.4', '1.5', '2.0', '2.1', '2.2', '2.3'].include?(version)
|
195
195
|
validate_server_version
|
196
196
|
elsif version && ['0.14', '1.0'].include?(version)
|
197
197
|
warn '[CRITICAL] Config version is too old. Try `migrate` instead of `import`.'
|
@@ -213,8 +213,12 @@ module SkullIsland
|
|
213
213
|
|
214
214
|
def validate_server_version
|
215
215
|
server_version = SkullIsland::APIClient.about_service['version']
|
216
|
-
|
216
|
+
case server_version
|
217
|
+
when /^2.[12]/
|
217
218
|
true
|
219
|
+
when /^2.0/
|
220
|
+
warn "[WARN] Older server version #{server_version} detected! " \
|
221
|
+
'You may encounter Service resource API exceptions.'
|
218
222
|
else
|
219
223
|
warn '[CRITICAL] Server version mismatch!'
|
220
224
|
exit 1
|