bump-cli 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bump/cli/commands/base.rb +7 -0
- data/lib/bump/cli/commands/deploy.rb +3 -12
- data/lib/bump/cli/commands/preview.rb +3 -12
- data/lib/bump/cli/commands/validate.rb +3 -12
- data/lib/bump/cli/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: eae58f754a98f3e2e633376bee6bd7dd3be44fc00e4f8c5d0a7d1b9f88e19236
|
4
|
+
data.tar.gz: bde4b9c983ef8dbccca2432526c86ab4417b1deef95994d2aff0412f009ee08f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0f74113804392d5f473e882b091567ce84cd2d09a9f980b35e2e9770170475d8856c667ec52926d2ff787e469f51fcb362dc1dd9414cee5e4ad14f49d916315
|
7
|
+
data.tar.gz: f241dfd78599b68123d1146546cc338f73c447db28aeb2247701bde03fe87bc7216af00b0ba5101ec021fd192e1dd1166b0cb597c3fef51bf8c72a54aa8d3ff7
|
@@ -6,6 +6,13 @@ module Bump
|
|
6
6
|
class Base < Hanami::CLI::Command
|
7
7
|
private
|
8
8
|
|
9
|
+
def body(file, specification)
|
10
|
+
{
|
11
|
+
definition: open(file).read,
|
12
|
+
specification: specification
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
9
16
|
def with_errors_rescued
|
10
17
|
yield
|
11
18
|
rescue HTTP::Error, Errno::ENOENT, SocketError => error
|
@@ -8,13 +8,13 @@ module Bump
|
|
8
8
|
argument :file, required: true, desc: "Path or URL to your API documentation file. Only OpenApi 2.0 (Swagger) specification is currently supported."
|
9
9
|
option :id, default: ENV.fetch("BUMP_ID", ""), desc: "Documentation public id"
|
10
10
|
option :token, default: ENV.fetch("BUMP_TOKEN", ""), desc: "Documentation private token"
|
11
|
-
option :
|
11
|
+
option :specification, default: 'openapi/v2/yaml', values: %w[openapi/v2/json openapi/v2/yaml], desc: "Specification of the definition"
|
12
12
|
|
13
|
-
def call(file:,
|
13
|
+
def call(file:, specification:, id:, token:)
|
14
14
|
with_errors_rescued do
|
15
15
|
response = HTTP
|
16
16
|
.headers(headers(token: token))
|
17
|
-
.post(API_URL + "/docs/#{id}/versions", body: body(file,
|
17
|
+
.post(API_URL + "/docs/#{id}/versions", body: body(file, specification).to_json)
|
18
18
|
|
19
19
|
if response.code == 201
|
20
20
|
puts "New version has been successfully deployed."
|
@@ -25,15 +25,6 @@ module Bump
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def body(file, format)
|
32
|
-
{
|
33
|
-
definition: open(file).read,
|
34
|
-
format: format
|
35
|
-
}
|
36
|
-
end
|
37
28
|
end
|
38
29
|
end
|
39
30
|
end
|
@@ -4,13 +4,13 @@ module Bump
|
|
4
4
|
class Preview < Base
|
5
5
|
desc "Create a documentation preview for the given file"
|
6
6
|
argument :file, required: true, desc: "Path or URL to your API documentation file. Only OpenApi 2.0 (Swagger) specification is currently supported."
|
7
|
-
option :
|
7
|
+
option :specification, default: 'openapi/v2/yaml', values: %w[openapi/v2/json openapi/v2/yaml], desc: "Specification of the definition"
|
8
8
|
|
9
|
-
def call(
|
9
|
+
def call(file:, specification:)
|
10
10
|
with_errors_rescued do
|
11
11
|
response = HTTP
|
12
12
|
.headers(headers)
|
13
|
-
.post(API_URL + "/previews", body: body(
|
13
|
+
.post(API_URL + "/previews", body: body(file, specification).to_json)
|
14
14
|
|
15
15
|
if response.code == 201
|
16
16
|
body = JSON.parse(response.body)
|
@@ -20,15 +20,6 @@ module Bump
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def body(options)
|
27
|
-
{
|
28
|
-
definition: open(options.fetch(:file)).read,
|
29
|
-
format: options.fetch(:format)
|
30
|
-
}
|
31
|
-
end
|
32
23
|
end
|
33
24
|
end
|
34
25
|
end
|
@@ -8,13 +8,13 @@ module Bump
|
|
8
8
|
argument :file, required: true, desc: "Path or URL to your API documentation file. Only OpenApi 2.0 (Swagger) specification is currently supported."
|
9
9
|
option :id, default: ENV.fetch("BUMP_ID", ""), desc: "Documentation public id"
|
10
10
|
option :token, default: ENV.fetch("BUMP_TOKEN", ""), desc: "Documentation private token"
|
11
|
-
option :
|
11
|
+
option :specification, default: 'openapi/v2/yaml', values: %w[openapi/v2/json openapi/v2/yaml], desc: "Specification of the definition"
|
12
12
|
|
13
|
-
def call(file:,
|
13
|
+
def call(file:, specification:, id:, token:)
|
14
14
|
with_errors_rescued do
|
15
15
|
response = HTTP
|
16
16
|
.headers(headers(token: token))
|
17
|
-
.post(API_URL + "/docs/#{id}/validations", body: body(file,
|
17
|
+
.post(API_URL + "/docs/#{id}/validations", body: body(file, specification).to_json)
|
18
18
|
|
19
19
|
if response.code == 200
|
20
20
|
puts "Definition is valid."
|
@@ -23,15 +23,6 @@ module Bump
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def body(file, format)
|
30
|
-
{
|
31
|
-
definition: open(file).read,
|
32
|
-
format: format
|
33
|
-
}
|
34
|
-
end
|
35
26
|
end
|
36
27
|
end
|
37
28
|
end
|
data/lib/bump/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bump-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehdi Lahmam
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-03-
|
12
|
+
date: 2018-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hanami-cli
|