bump-cli 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/cli-runtime-error.md +26 -0
- data/Gemfile +1 -1
- data/README.md +4 -1
- data/bump-cli.gemspec +17 -17
- data/lib/bump/cli/commands/base.rb +34 -25
- data/lib/bump/cli/commands/deploy.rb +5 -5
- data/lib/bump/cli/commands/preview.rb +4 -3
- data/lib/bump/cli/commands/validate.rb +5 -5
- data/lib/bump/cli/definition.rb +12 -23
- data/lib/bump/cli/references.rb +29 -53
- data/lib/bump/cli/resource.rb +26 -0
- data/lib/bump/cli/version.rb +1 -1
- metadata +18 -3
- data/lib/bump/cli/parser.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00d797137b0dae0f38a0a9106badd11c90ffacd37648eb7d2bdcdc4370e0e2b0
|
4
|
+
data.tar.gz: 1cd3d2d72d423284a9a0ffc3c0f86fd577b2ece23acf68f0fa36e43896aae730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e2a0eaa1fb62b4f9b7b5f88883e8f00ded7653467d80f3776a8aadf6f0190e32fdb620acc3e8568e30be88fa4e7f5370ec7e777137ecda72cc7e77a6cdd5576
|
7
|
+
data.tar.gz: c3f88a2d70ff4f893a13b985beb3f8198f349a02fed67f93e7949527867acc9655409a586db8f13a364b145b467c70d5cede4c4f74e3aa42b92c558140afc5a5
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
name: CLI runtime error
|
3
|
+
about: Create a report of an exception happening when running a CLI command
|
4
|
+
title: "[ERROR MESSAGE]"
|
5
|
+
labels: ""
|
6
|
+
assignees: ""
|
7
|
+
---
|
8
|
+
|
9
|
+
**Describe the bug**
|
10
|
+
A clear and concise description of what the bug is.
|
11
|
+
|
12
|
+
**Command**
|
13
|
+
Paste here the exact command executed (with arguments and options) which led to the bug.
|
14
|
+
|
15
|
+
**Stack trace**
|
16
|
+
Paste here the stack trace displayed by the CLI, if available.
|
17
|
+
|
18
|
+
**Screenshots**
|
19
|
+
If applicable, add screenshots to help explain your problem.
|
20
|
+
|
21
|
+
**Desktop (please complete the following information):**
|
22
|
+
- OS: [e.g. macOS Catalina 10.15.7]
|
23
|
+
- Ruby version [e.g. 2.7]
|
24
|
+
|
25
|
+
**Additional context**
|
26
|
+
Add any other context about the problem here. If publishable, do not hesitate to join the specification you were trying to deploy/preview on Bump.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -29,7 +29,10 @@ Bump tries to identify your file specification and format automatically. You can
|
|
29
29
|
* `asyncapi/v2/json`
|
30
30
|
* `asyncapi/v2/yaml`
|
31
31
|
|
32
|
-
|
32
|
+
Both the `--doc` and `--token` options used below can be found in your documentation settings page on https://bump.sh. Note that you can replace both the `--doc` and `--token` option by an environment variable. This will help to keep those values secret:
|
33
|
+
|
34
|
+
- `--doc` can by replaced by `BUMP_ID`.
|
35
|
+
- `--token` can by replaced by `BUMP_TOKEN`.
|
33
36
|
|
34
37
|
### Preview
|
35
38
|
|
data/bump-cli.gemspec
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "bump/cli/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
6
|
+
spec.name = "bump-cli"
|
7
|
+
spec.version = Bump::CLI::VERSION
|
8
|
+
spec.authors = ["Mehdi Lahmam", "Sébastien Charrier"]
|
9
|
+
spec.email = ["mehdi@lahmam.com", "sebastien@bump.sh"]
|
11
10
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
11
|
+
spec.summary = "Bump.sh CLI"
|
12
|
+
spec.description = "Bump.sh CLI to interact with the API"
|
13
|
+
spec.homepage = "https://bump.sh"
|
14
|
+
spec.license = "MIT"
|
16
15
|
|
17
16
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
|
-
spec.metadata["source_code_uri"]
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/bump-sh/bump-cli"
|
19
18
|
|
20
|
-
spec.files
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
20
|
f.match(%r{^(test|spec|features)/})
|
22
21
|
end
|
23
|
-
spec.bindir
|
24
|
-
spec.executables
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
24
|
spec.require_paths = ["lib"]
|
26
25
|
|
27
|
-
spec.required_ruby_version =
|
26
|
+
spec.required_ruby_version = ">= 2.3"
|
28
27
|
|
29
|
-
spec.add_dependency "dry-cli",
|
30
|
-
spec.add_dependency "http",
|
28
|
+
spec.add_dependency "dry-cli", "~> 0"
|
29
|
+
spec.add_dependency "http", ">= 3"
|
31
30
|
|
32
31
|
spec.add_development_dependency "bundler", ">= 1", "< 3"
|
33
32
|
spec.add_development_dependency "byebug", "~> 11"
|
34
|
-
spec.add_development_dependency "climate_control",
|
33
|
+
spec.add_development_dependency "climate_control", "~> 0"
|
35
34
|
spec.add_development_dependency "rake", "~> 13"
|
36
35
|
spec.add_development_dependency "rspec", "~> 3"
|
36
|
+
spec.add_development_dependency "standard"
|
37
37
|
spec.add_development_dependency "webmock", "~> 3"
|
38
38
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "bump/cli/definition"
|
2
|
+
require "bump/cli/uuid"
|
3
3
|
|
4
4
|
module Bump
|
5
5
|
class CLI
|
@@ -18,9 +18,13 @@ module Bump
|
|
18
18
|
def body(file, **options)
|
19
19
|
deprecation_warning(options)
|
20
20
|
|
21
|
+
definition = Definition.new(file, import_external_references: !options[:'no-external-references'])
|
22
|
+
definition.prepare!
|
23
|
+
|
21
24
|
compact(
|
22
25
|
{
|
23
|
-
definition:
|
26
|
+
definition: definition.content,
|
27
|
+
references: prepare_references(definition.external_references),
|
24
28
|
specification: options[:specification],
|
25
29
|
validation: options[:validation],
|
26
30
|
auto_create_documentation: options[:'auto-create']
|
@@ -28,20 +32,18 @@ module Bump
|
|
28
32
|
)
|
29
33
|
end
|
30
34
|
|
31
|
-
def
|
32
|
-
|
35
|
+
def prepare_references(references)
|
36
|
+
references.reduce([]) { |references, (location, content)|
|
37
|
+
references << {location: location, content: content}
|
38
|
+
}
|
33
39
|
end
|
34
40
|
|
35
41
|
def deprecation_warning(options)
|
36
|
-
if
|
37
|
-
puts "[DEPRECATION WARNING] --
|
42
|
+
if options[:"import-external-references"]
|
43
|
+
puts "[DEPRECATION WARNING] --import-external-references option is deprecated. External references are imported by default."
|
38
44
|
end
|
39
45
|
end
|
40
46
|
|
41
|
-
def present?(string)
|
42
|
-
!string.nil? && string != ''
|
43
|
-
end
|
44
|
-
|
45
47
|
def compact(hash)
|
46
48
|
hash.delete_if { |key, value| value.nil? }
|
47
49
|
end
|
@@ -79,16 +81,24 @@ module Bump
|
|
79
81
|
yield
|
80
82
|
rescue HTTP::Error, Errno::ENOENT, SocketError => error
|
81
83
|
abort "Error: #{error.message}"
|
84
|
+
rescue => error
|
85
|
+
warn "An unexpected error occurred. Sorry about that!"
|
86
|
+
warn "We don't monitor errors raised by the CLI running on your computer, so we have not been notified."
|
87
|
+
warn "You can help us fix this by creating an issue on https://github.com/bump-sh/bump-cli/issues/new?template=cli-runtime-error.md."
|
88
|
+
warn "\n"
|
89
|
+
warn "#{error.class}: #{error.message}"
|
90
|
+
warn error.backtrace.take(10).join("\n")
|
91
|
+
exit(1)
|
82
92
|
end
|
83
93
|
|
84
|
-
def headers(token:
|
94
|
+
def headers(token: "")
|
85
95
|
headers = {
|
86
|
-
|
87
|
-
|
96
|
+
"Content-Type" => "application/json",
|
97
|
+
"User-Agent" => USER_AGENT
|
88
98
|
}
|
89
99
|
|
90
100
|
if token
|
91
|
-
headers[
|
101
|
+
headers["Authorization"] = "Basic #{Base64.strict_encode64(token + ":")}"
|
92
102
|
end
|
93
103
|
|
94
104
|
headers
|
@@ -109,9 +119,9 @@ module Bump
|
|
109
119
|
end
|
110
120
|
|
111
121
|
def display_validation_errors(body)
|
112
|
-
errors = body.dig(
|
122
|
+
errors = body.dig("errors") || []
|
113
123
|
|
114
|
-
|
124
|
+
warn "Invalid request:"
|
115
125
|
errors.each do |attribute, messages|
|
116
126
|
display_attribute_errors(attribute, messages)
|
117
127
|
end
|
@@ -120,15 +130,14 @@ module Bump
|
|
120
130
|
end
|
121
131
|
|
122
132
|
def display_attribute_errors(attribute, messages)
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
$stderr.puts "- #{attribute}:"
|
133
|
+
if messages.is_a?(String)
|
134
|
+
warn "- #{attribute}: #{messages}"
|
135
|
+
elsif messages.is_a?(Array) && messages.count == 1
|
136
|
+
warn "- #{attribute}: #{messages[0]}"
|
137
|
+
elsif messages.is_a?(Array)
|
138
|
+
warn "- #{attribute}:"
|
130
139
|
messages.each do |message|
|
131
|
-
|
140
|
+
warn " #{message}"
|
132
141
|
end
|
133
142
|
end
|
134
143
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "base64"
|
2
2
|
|
3
3
|
module Bump
|
4
4
|
class CLI
|
@@ -6,15 +6,15 @@ module Bump
|
|
6
6
|
class Deploy < Base
|
7
7
|
desc "Create a new version"
|
8
8
|
argument :file, required: true, desc: "Path or URL to your API documentation file. OpenAPI (2.0 to 3.0.2) and AsyncAPI (2.0) specifications are currently supported."
|
9
|
-
option :id, default: ENV.fetch("BUMP_ID", ""), desc: "[DEPRECATED] Documentation id. Use `documentation` option instead"
|
10
9
|
option :doc, default: ENV.fetch("BUMP_ID", ""), desc: "Documentation id or slug"
|
11
10
|
option :'doc-name', desc: "Documentation name. Used with --auto-create flag."
|
12
11
|
option :hub, default: ENV.fetch("BUMP_HUB_ID", ""), desc: "Hub id or slug"
|
13
12
|
option :token, default: ENV.fetch("BUMP_TOKEN", ""), desc: "Documentation or Hub token"
|
14
13
|
option :specification, desc: "Specification of the definition"
|
15
|
-
option :validation, desc: "Validation mode", values: %w
|
16
|
-
option :'auto-create', type: :boolean, default: false, desc:
|
17
|
-
option :'
|
14
|
+
option :validation, desc: "Validation mode", values: %w[basic strict], default: "basic"
|
15
|
+
option :'auto-create', type: :boolean, default: false, desc: "Automatically create the documentation if needed (only available with a hub and when specifying a slug for documentation)"
|
16
|
+
option :'no-external-references', type: :boolean, default: false, desc: "Do not import external references ($ref)"
|
17
|
+
option :'import-external-references', type: :boolean, default: false, desc: "[DEPRECATED] External references are imported by default"
|
18
18
|
|
19
19
|
def call(file:, **options)
|
20
20
|
with_errors_rescued do
|
@@ -5,8 +5,9 @@ module Bump
|
|
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. OpenAPI (2.0 to 3.0.2) and AsyncAPI (2.0) specifications are currently supported."
|
7
7
|
option :specification, desc: "Specification of the definition"
|
8
|
-
option :validation, desc: "Validation mode", values: %w
|
9
|
-
option :'
|
8
|
+
option :validation, desc: "Validation mode", values: %w[basic strict], default: "basic"
|
9
|
+
option :'no-external-references', type: :boolean, default: false, desc: "Do not import external references ($ref)"
|
10
|
+
option :'import-external-references', type: :boolean, default: false, desc: "[DEPRECATED] External references are imported by default"
|
10
11
|
|
11
12
|
def call(file:, **options)
|
12
13
|
with_errors_rescued do
|
@@ -17,7 +18,7 @@ module Bump
|
|
17
18
|
|
18
19
|
if response.code == 201
|
19
20
|
body = JSON.parse(response.body)
|
20
|
-
puts "Preview created : #{ROOT_URL +
|
21
|
+
puts "Preview created : #{ROOT_URL + "/preview/" + body["id"]} (expires at #{body["expires_at"]})"
|
21
22
|
else
|
22
23
|
display_error(response)
|
23
24
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "base64"
|
2
2
|
|
3
3
|
module Bump
|
4
4
|
class CLI
|
@@ -6,15 +6,15 @@ module Bump
|
|
6
6
|
class Validate < Base
|
7
7
|
desc "Validate a given file against its schema definition"
|
8
8
|
argument :file, required: true, desc: "Path or URL to your API documentation file. OpenAPI (2.0 to 3.0.2) and AsyncAPI (2.0) specifications are currently supported."
|
9
|
-
option :id, default: ENV.fetch("BUMP_ID", ""), desc: "[DEPRECATED] Documentation id. Use `documentation` option instead"
|
10
9
|
option :doc, default: ENV.fetch("BUMP_ID", ""), desc: "Documentation public id or slug"
|
11
10
|
option :'doc-name', desc: "Documentation name. Used with --auto-create flag."
|
12
11
|
option :hub, desc: "Hub id or slug"
|
13
12
|
option :token, default: ENV.fetch("BUMP_TOKEN", ""), desc: "Documentation or Hub token"
|
14
13
|
option :specification, desc: "Specification of the definition"
|
15
|
-
option :validation, desc: "Validation mode", values: %w
|
16
|
-
option :'auto-create', type: :boolean, default: false, desc:
|
17
|
-
option :'
|
14
|
+
option :validation, desc: "Validation mode", values: %w[basic strict], default: "basic"
|
15
|
+
option :'auto-create', type: :boolean, default: false, desc: "Automatically create the documentation if needed (only available with a hub and when specifying a slug for documentation)"
|
16
|
+
option :'no-external-references', type: :boolean, default: false, desc: "Do not import external references ($ref)"
|
17
|
+
option :'import-external-references', type: :boolean, default: false, desc: "[DEPRECATED] External references are imported by default"
|
18
18
|
|
19
19
|
def call(file:, **options)
|
20
20
|
with_errors_rescued do
|
data/lib/bump/cli/definition.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require 'bump/cli/references'
|
1
|
+
require "bump/cli/references"
|
2
|
+
require "bump/cli/resource"
|
4
3
|
|
5
4
|
module Bump
|
6
5
|
class CLI
|
7
6
|
class Definition
|
7
|
+
attr_reader :content, :external_references
|
8
|
+
|
8
9
|
def initialize(path, import_external_references: false)
|
9
10
|
@path = path
|
10
11
|
@import_external_references = import_external_references
|
12
|
+
@external_references = References.new(root_path: find_base_path(path))
|
11
13
|
end
|
12
14
|
|
13
|
-
def prepare
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def prepare!
|
16
|
+
@content = Resource.read(path)
|
17
|
+
|
18
|
+
if import_external_references
|
19
|
+
external_references.load(Resource.parse(content))
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -22,21 +24,8 @@ module Bump
|
|
22
24
|
|
23
25
|
attr_reader :path, :import_external_references
|
24
26
|
|
25
|
-
def
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def parse_file_and_import_external_references
|
30
|
-
original_format, definition = parser.load(read_file)
|
31
|
-
|
32
|
-
references = References.new(definition, base_path: path)
|
33
|
-
references.import!
|
34
|
-
|
35
|
-
parser.dump(references.definition, original_format)
|
36
|
-
end
|
37
|
-
|
38
|
-
def parser
|
39
|
-
@parser ||= Parser.new
|
27
|
+
def find_base_path(path)
|
28
|
+
Pathname.new(path.to_s).dirname.to_s + Pathname::SEPARATOR_LIST
|
40
29
|
end
|
41
30
|
end
|
42
31
|
end
|
data/lib/bump/cli/references.rb
CHANGED
@@ -1,91 +1,67 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "open-uri"
|
2
|
+
require "pathname"
|
3
3
|
|
4
4
|
module Bump
|
5
5
|
class CLI
|
6
|
-
class References
|
7
|
-
|
8
|
-
|
9
|
-
def initialize(definition, base_path: '')
|
10
|
-
@definition = definition
|
11
|
-
@base_path = cleanup(base_path)
|
12
|
-
@processed = false
|
13
|
-
@external_references = {}
|
6
|
+
class References < Hash
|
7
|
+
def initialize(root_path: "")
|
8
|
+
@root_path = root_path
|
14
9
|
end
|
15
10
|
|
16
|
-
def
|
17
|
-
if
|
18
|
-
@definition = traverse_and_replace_external_references(definition)
|
19
|
-
import_references
|
20
|
-
@processed = true
|
21
|
-
end
|
11
|
+
def load(definition)
|
12
|
+
traverse_and_load_external_references(definition) if definition.is_a?(Enumerable)
|
22
13
|
end
|
23
14
|
|
24
15
|
private
|
25
16
|
|
26
|
-
attr_reader :
|
17
|
+
attr_reader :root_path
|
27
18
|
|
28
|
-
def
|
19
|
+
def traverse_and_load_external_references(current)
|
29
20
|
current.each do |key, value|
|
30
|
-
if key ==
|
31
|
-
|
21
|
+
if key == "$ref"
|
22
|
+
load_external_reference(value) if external?(value)
|
32
23
|
elsif value.is_a?(Hash)
|
33
|
-
|
24
|
+
traverse_and_load_external_references(value)
|
34
25
|
elsif value.is_a?(Array)
|
35
26
|
value.each do |array_value|
|
36
|
-
|
27
|
+
if array_value.is_a?(Hash)
|
28
|
+
traverse_and_load_external_references(array_value)
|
29
|
+
end
|
37
30
|
end
|
38
31
|
end
|
39
32
|
end
|
40
33
|
end
|
41
34
|
|
42
|
-
def
|
43
|
-
if
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
subpath = reference[/#(.*)$/, 1]
|
49
|
-
"#/components/x-imported/#{external_references[reference]}#{ '/' + subpath if !subpath.nil? }"
|
50
|
-
else
|
51
|
-
reference
|
35
|
+
def load_external_reference(reference)
|
36
|
+
if self[reference].nil?
|
37
|
+
base_reference = cleanup_reference(reference)
|
38
|
+
location = prepare_location(base_reference)
|
39
|
+
self[base_reference] = Resource.read(location)
|
52
40
|
end
|
53
41
|
end
|
54
42
|
|
55
|
-
def
|
56
|
-
|
57
|
-
@definition['components'] = {} if @definition['components'].nil?
|
58
|
-
@definition['components']['x-imported'] = {} if @definition['components']['x-imported'].nil?
|
59
|
-
|
60
|
-
external_references.each do |key, value|
|
61
|
-
_, @definition['components']['x-imported'][value.to_s] = Parser.new.load(open(prepare_path(key)).read)
|
62
|
-
end
|
63
|
-
end
|
43
|
+
def cleanup_reference(reference)
|
44
|
+
reference.sub(/#.*/, "")
|
64
45
|
end
|
65
46
|
|
66
|
-
def
|
67
|
-
|
68
|
-
|
69
|
-
key
|
47
|
+
def prepare_location(reference)
|
48
|
+
if url?(reference) || absolute_path?(reference)
|
49
|
+
reference
|
70
50
|
else
|
71
|
-
|
51
|
+
root_path + reference
|
72
52
|
end
|
73
53
|
end
|
74
54
|
|
75
55
|
def external?(reference)
|
76
|
-
!reference.start_with?(
|
56
|
+
!reference.start_with?("#")
|
77
57
|
end
|
78
58
|
|
79
59
|
def url?(path)
|
80
|
-
path.start_with?(
|
60
|
+
path.start_with?("http")
|
81
61
|
end
|
82
62
|
|
83
63
|
def absolute_path?(path)
|
84
|
-
path.start_with?(
|
85
|
-
end
|
86
|
-
|
87
|
-
def cleanup(path)
|
88
|
-
Pathname.new(path).dirname.to_s + Pathname::SEPARATOR_LIST
|
64
|
+
path.start_with?("/")
|
89
65
|
end
|
90
66
|
end
|
91
67
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "json"
|
2
|
+
require "yaml"
|
3
|
+
|
4
|
+
module Bump
|
5
|
+
class CLI
|
6
|
+
class Resource
|
7
|
+
def self.read(location)
|
8
|
+
if location.start_with?("http")
|
9
|
+
::HTTP.get(location).to_s
|
10
|
+
else
|
11
|
+
::File.read(location).force_encoding(Encoding::UTF_8)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.parse(content)
|
16
|
+
::JSON.parse(content)
|
17
|
+
rescue ::JSON::ParserError
|
18
|
+
begin
|
19
|
+
::YAML.safe_load(content, [Date, Time])
|
20
|
+
rescue ::Psych::SyntaxError
|
21
|
+
content
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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.7.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:
|
12
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dry-cli
|
@@ -115,6 +115,20 @@ dependencies:
|
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '3'
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: standard
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
type: :development
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
118
132
|
- !ruby/object:Gem::Dependency
|
119
133
|
name: webmock
|
120
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,6 +153,7 @@ extensions: []
|
|
139
153
|
extra_rdoc_files: []
|
140
154
|
files:
|
141
155
|
- ".circleci/config.yml"
|
156
|
+
- ".github/ISSUE_TEMPLATE/cli-runtime-error.md"
|
142
157
|
- ".gitignore"
|
143
158
|
- ".travis.yml"
|
144
159
|
- CODE_OF_CONDUCT.md
|
@@ -156,8 +171,8 @@ files:
|
|
156
171
|
- lib/bump/cli/commands/preview.rb
|
157
172
|
- lib/bump/cli/commands/validate.rb
|
158
173
|
- lib/bump/cli/definition.rb
|
159
|
-
- lib/bump/cli/parser.rb
|
160
174
|
- lib/bump/cli/references.rb
|
175
|
+
- lib/bump/cli/resource.rb
|
161
176
|
- lib/bump/cli/uuid.rb
|
162
177
|
- lib/bump/cli/version.rb
|
163
178
|
homepage: https://bump.sh
|
data/lib/bump/cli/parser.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
module Bump
|
5
|
-
class CLI
|
6
|
-
class Parser
|
7
|
-
def load(content)
|
8
|
-
[:json, ::JSON.parse(content)]
|
9
|
-
rescue ::JSON::ParserError => e
|
10
|
-
begin
|
11
|
-
[:yaml, ::YAML.safe_load(content, [Date, Time])]
|
12
|
-
rescue ::Psych::SyntaxError
|
13
|
-
[:text, content]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def dump(definition, format)
|
18
|
-
if format == :yaml
|
19
|
-
::YAML.dump(definition)
|
20
|
-
else
|
21
|
-
::JSON.dump(definition)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|