bump-cli 0.5.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +14 -4
- data/.github/ISSUE_TEMPLATE/cli-runtime-error.md +26 -0
- data/Gemfile +1 -1
- data/README.md +11 -1
- data/bump-cli.gemspec +17 -17
- data/lib/bump/cli.rb +8 -0
- data/lib/bump/cli/commands/base.rb +38 -25
- data/lib/bump/cli/commands/deploy.rb +8 -7
- data/lib/bump/cli/commands/preview.rb +5 -3
- data/lib/bump/cli/commands/validate.rb +6 -5
- data/lib/bump/cli/definition.rb +32 -0
- data/lib/bump/cli/references.rb +68 -0
- data/lib/bump/cli/resource.rb +27 -0
- data/lib/bump/cli/uuid.rb +11 -0
- data/lib/bump/cli/version.rb +1 -1
- metadata +25 -8
- data/lib/bump/cli/tools/uuid.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7864d9fa40e4b79da664f8c470553d4cb441c68b98ec7864f14a73a1bf74cca7
|
4
|
+
data.tar.gz: 9bf79f7526d64a7d4505401f7b624f2f24970d181005cb0fecb7fdcca9169c84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9bdb8df99ff13e7b0b41a0d8512bb9a950882eecafca78374fcee7e8f8e88eb43a9cc0efc75e97ef4c82405ff1d8e43d77a84153e94fc235072ebce1f390517
|
7
|
+
data.tar.gz: 721abefc4a876cd07f6a09195b63973131ef17353acf7133891d9f31106527ce1a7c250e3847d495e97d0e80eb4fe4b421d6f05555b3e97c1578c56539ecb8e4
|
data/.circleci/config.yml
CHANGED
@@ -3,7 +3,7 @@ jobs:
|
|
3
3
|
build-latest: &common-build
|
4
4
|
working_directory: ~/bump-cli
|
5
5
|
docker:
|
6
|
-
- image: circleci/ruby:
|
6
|
+
- image: circleci/ruby:latest
|
7
7
|
steps:
|
8
8
|
- checkout
|
9
9
|
- run:
|
@@ -29,20 +29,30 @@ jobs:
|
|
29
29
|
|
30
30
|
- run:
|
31
31
|
name: Run tests
|
32
|
-
command:
|
32
|
+
command: bundle exec rspec
|
33
|
+
build-2-6:
|
34
|
+
<<: *common-build
|
35
|
+
docker:
|
36
|
+
- image: circleci/ruby:2.6
|
37
|
+
build-2-5:
|
38
|
+
<<: *common-build
|
39
|
+
docker:
|
40
|
+
- image: circleci/ruby:2.5
|
33
41
|
build-2-4:
|
34
42
|
<<: *common-build
|
35
43
|
docker:
|
36
|
-
- image: circleci/ruby:2.4
|
44
|
+
- image: circleci/ruby:2.4
|
37
45
|
build-2-3:
|
38
46
|
<<: *common-build
|
39
47
|
docker:
|
40
|
-
- image: circleci/ruby:2.3
|
48
|
+
- image: circleci/ruby:2.3
|
41
49
|
|
42
50
|
workflows:
|
43
51
|
version: 2
|
44
52
|
build:
|
45
53
|
jobs:
|
46
54
|
- build-latest
|
55
|
+
- build-2-6
|
56
|
+
- build-2-5
|
47
57
|
- build-2-4
|
48
58
|
- build-2-3
|
@@ -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
@@ -1,5 +1,12 @@
|
|
1
1
|
# Bump::CLI
|
2
2
|
|
3
|
+
**⚠️ DEPRECATION WARNING:** This repository is now deprecated in favor of our [new Node based Bump CLI](https://github.com/bump-sh/cli). Please migrate to v2.x+ version of our CLI to enjoy all features of Bump.sh. ⚠️
|
4
|
+
|
5
|
+
- [**Read the new CLI announcement**](https://headwayapp.co/bump-changelog/new-command-line-interface-era-196226)
|
6
|
+
- [**Read our Bump CLI help section**](https://help.bump.sh/bump-cli)
|
7
|
+
|
8
|
+
_If you still want to use this ruby gem, please [contact us](mailto:hello@bump.sh) to discuss alternatives and share your use case. Thank you!_
|
9
|
+
|
3
10
|
The `bump-cli` gem provides a simple command line access to the Bump (https://bump.sh) API.
|
4
11
|
|
5
12
|
## Installation
|
@@ -29,7 +36,10 @@ Bump tries to identify your file specification and format automatically. You can
|
|
29
36
|
* `asyncapi/v2/json`
|
30
37
|
* `asyncapi/v2/yaml`
|
31
38
|
|
32
|
-
|
39
|
+
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:
|
40
|
+
|
41
|
+
- `--doc` can by replaced by `BUMP_ID`.
|
42
|
+
- `--token` can by replaced by `BUMP_TOKEN`.
|
33
43
|
|
34
44
|
### Preview
|
35
45
|
|
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
|
data/lib/bump/cli.rb
CHANGED
@@ -9,6 +9,14 @@ module Bump
|
|
9
9
|
API_URL = ROOT_URL + API_PATH
|
10
10
|
|
11
11
|
def call(*args)
|
12
|
+
warn ":WARNING:"
|
13
|
+
warn " This Bump CLI is now legacy and will not be maintained any further."
|
14
|
+
warn ""
|
15
|
+
warn " Please update to our new v2.x CLI available at https://github.com/bump-sh/cli"
|
16
|
+
warn " You can install the new Bump CLI with 'npm install -g bump-cli'"
|
17
|
+
warn " or 'yarn global add bump-cli'"
|
18
|
+
warn ":WARNING:"
|
19
|
+
warn ""
|
12
20
|
Dry::CLI.new(Commands).call(*args)
|
13
21
|
end
|
14
22
|
|
@@ -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,14 +32,16 @@ module Bump
|
|
28
32
|
)
|
29
33
|
end
|
30
34
|
|
31
|
-
def
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
+
def prepare_references(references)
|
36
|
+
references.reduce([]) { |references, (location, content)|
|
37
|
+
references << {location: location, content: content}
|
38
|
+
}
|
35
39
|
end
|
36
40
|
|
37
|
-
def
|
38
|
-
|
41
|
+
def deprecation_warning(options)
|
42
|
+
if options[:"import-external-references"]
|
43
|
+
puts "[DEPRECATION WARNING] --import-external-references option is deprecated. External references are imported by default."
|
44
|
+
end
|
39
45
|
end
|
40
46
|
|
41
47
|
def compact(hash)
|
@@ -56,7 +62,7 @@ module Bump
|
|
56
62
|
end
|
57
63
|
|
58
64
|
def documentation_uuid?(options)
|
59
|
-
Bump::CLI::
|
65
|
+
Bump::CLI::UUID.valid?(options[:doc])
|
60
66
|
end
|
61
67
|
|
62
68
|
def documentation_slug?(options)
|
@@ -64,7 +70,7 @@ module Bump
|
|
64
70
|
end
|
65
71
|
|
66
72
|
def hub_uuid?(options)
|
67
|
-
Bump::CLI::
|
73
|
+
Bump::CLI::UUID.valid?(options[:hub])
|
68
74
|
end
|
69
75
|
|
70
76
|
def hub_slug?(options)
|
@@ -75,16 +81,24 @@ module Bump
|
|
75
81
|
yield
|
76
82
|
rescue HTTP::Error, Errno::ENOENT, SocketError => error
|
77
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)
|
78
92
|
end
|
79
93
|
|
80
|
-
def headers(token:
|
94
|
+
def headers(token: "")
|
81
95
|
headers = {
|
82
|
-
|
83
|
-
|
96
|
+
"Content-Type" => "application/json",
|
97
|
+
"User-Agent" => USER_AGENT
|
84
98
|
}
|
85
99
|
|
86
100
|
if token
|
87
|
-
headers[
|
101
|
+
headers["Authorization"] = "Basic #{Base64.strict_encode64(token + ":")}"
|
88
102
|
end
|
89
103
|
|
90
104
|
headers
|
@@ -105,9 +119,9 @@ module Bump
|
|
105
119
|
end
|
106
120
|
|
107
121
|
def display_validation_errors(body)
|
108
|
-
errors = body.dig(
|
122
|
+
errors = body.dig("errors") || []
|
109
123
|
|
110
|
-
|
124
|
+
warn "Invalid request:"
|
111
125
|
errors.each do |attribute, messages|
|
112
126
|
display_attribute_errors(attribute, messages)
|
113
127
|
end
|
@@ -116,15 +130,14 @@ module Bump
|
|
116
130
|
end
|
117
131
|
|
118
132
|
def display_attribute_errors(attribute, messages)
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
$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}:"
|
126
139
|
messages.each do |message|
|
127
|
-
|
140
|
+
warn " #{message}"
|
128
141
|
end
|
129
142
|
end
|
130
143
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "base64"
|
2
2
|
|
3
3
|
module Bump
|
4
4
|
class CLI
|
@@ -6,27 +6,28 @@ 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:
|
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"
|
17
18
|
|
18
19
|
def call(file:, **options)
|
19
20
|
with_errors_rescued do
|
20
21
|
response = post(
|
21
22
|
url: API_URL + "/versions",
|
22
|
-
body: body(file, options).to_json,
|
23
|
+
body: body(file, **options).to_json,
|
23
24
|
token: options[:token]
|
24
25
|
)
|
25
26
|
|
26
27
|
if response.code == 201
|
27
|
-
puts "
|
28
|
+
puts "The new version is currently being processed."
|
28
29
|
elsif response.code == 204
|
29
|
-
puts "
|
30
|
+
puts "This version has already been deployed."
|
30
31
|
else
|
31
32
|
display_error(response)
|
32
33
|
end
|
@@ -5,18 +5,20 @@ 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
|
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"
|
9
11
|
|
10
12
|
def call(file:, **options)
|
11
13
|
with_errors_rescued do
|
12
14
|
response = post(
|
13
15
|
url: API_URL + "/previews",
|
14
|
-
body: body(file, options).to_json
|
16
|
+
body: body(file, **options).to_json
|
15
17
|
)
|
16
18
|
|
17
19
|
if response.code == 201
|
18
20
|
body = JSON.parse(response.body)
|
19
|
-
puts "Preview created : #{ROOT_URL +
|
21
|
+
puts "Preview created : #{ROOT_URL + "/preview/" + body["id"]} (expires at #{body["expires_at"]})"
|
20
22
|
else
|
21
23
|
display_error(response)
|
22
24
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "base64"
|
2
2
|
|
3
3
|
module Bump
|
4
4
|
class CLI
|
@@ -6,20 +6,21 @@ 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:
|
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"
|
17
18
|
|
18
19
|
def call(file:, **options)
|
19
20
|
with_errors_rescued do
|
20
21
|
response = post(
|
21
22
|
url: API_URL + "/validations",
|
22
|
-
body: body(file, options).to_json,
|
23
|
+
body: body(file, **options).to_json,
|
23
24
|
token: options[:token]
|
24
25
|
)
|
25
26
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "bump/cli/references"
|
2
|
+
require "bump/cli/resource"
|
3
|
+
|
4
|
+
module Bump
|
5
|
+
class CLI
|
6
|
+
class Definition
|
7
|
+
attr_reader :content, :external_references
|
8
|
+
|
9
|
+
def initialize(path, import_external_references: false)
|
10
|
+
@path = path
|
11
|
+
@import_external_references = import_external_references
|
12
|
+
@external_references = References.new(root_path: find_base_path(path))
|
13
|
+
end
|
14
|
+
|
15
|
+
def prepare!
|
16
|
+
@content = Resource.read(path)
|
17
|
+
|
18
|
+
if import_external_references
|
19
|
+
external_references.load(Resource.parse(content))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :path, :import_external_references
|
26
|
+
|
27
|
+
def find_base_path(path)
|
28
|
+
Pathname.new(path.to_s).dirname.to_s + Pathname::SEPARATOR_LIST
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require "open-uri"
|
2
|
+
require "pathname"
|
3
|
+
|
4
|
+
module Bump
|
5
|
+
class CLI
|
6
|
+
class References < Hash
|
7
|
+
def initialize(root_path: "")
|
8
|
+
@root_path = root_path
|
9
|
+
end
|
10
|
+
|
11
|
+
def load(definition)
|
12
|
+
traverse_and_load_external_references(definition) if definition.is_a?(Enumerable)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
attr_reader :root_path
|
18
|
+
|
19
|
+
def traverse_and_load_external_references(current)
|
20
|
+
current.each do |key, value|
|
21
|
+
if key == "$ref"
|
22
|
+
load_external_reference(value) if external?(value)
|
23
|
+
elsif value.is_a?(Hash)
|
24
|
+
traverse_and_load_external_references(value)
|
25
|
+
elsif value.is_a?(Array)
|
26
|
+
value.each do |array_value|
|
27
|
+
if array_value.is_a?(Hash)
|
28
|
+
traverse_and_load_external_references(array_value)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
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)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def cleanup_reference(reference)
|
44
|
+
reference.sub(/#.*/, "")
|
45
|
+
end
|
46
|
+
|
47
|
+
def prepare_location(reference)
|
48
|
+
if url?(reference) || absolute_path?(reference)
|
49
|
+
reference
|
50
|
+
else
|
51
|
+
root_path + reference
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def external?(reference)
|
56
|
+
!reference.start_with?("#")
|
57
|
+
end
|
58
|
+
|
59
|
+
def url?(path)
|
60
|
+
path.start_with?("http")
|
61
|
+
end
|
62
|
+
|
63
|
+
def absolute_path?(path)
|
64
|
+
path.start_with?("/")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,27 @@
|
|
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.follow(max_hops: 50)
|
10
|
+
.get(location).to_s
|
11
|
+
else
|
12
|
+
::File.read(location).force_encoding(Encoding::UTF_8)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.parse(content)
|
17
|
+
::JSON.parse(content)
|
18
|
+
rescue ::JSON::ParserError
|
19
|
+
begin
|
20
|
+
::YAML.safe_load(content, [Date, Time])
|
21
|
+
rescue ::Psych::SyntaxError
|
22
|
+
content
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/bump/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bump-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehdi Lahmam
|
8
8
|
- Sébastien Charrier
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-07-16 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
|
@@ -155,7 +170,10 @@ files:
|
|
155
170
|
- lib/bump/cli/commands/deploy.rb
|
156
171
|
- lib/bump/cli/commands/preview.rb
|
157
172
|
- lib/bump/cli/commands/validate.rb
|
158
|
-
- lib/bump/cli/
|
173
|
+
- lib/bump/cli/definition.rb
|
174
|
+
- lib/bump/cli/references.rb
|
175
|
+
- lib/bump/cli/resource.rb
|
176
|
+
- lib/bump/cli/uuid.rb
|
159
177
|
- lib/bump/cli/version.rb
|
160
178
|
homepage: https://bump.sh
|
161
179
|
licenses:
|
@@ -163,7 +181,7 @@ licenses:
|
|
163
181
|
metadata:
|
164
182
|
allowed_push_host: https://rubygems.org
|
165
183
|
source_code_uri: https://github.com/bump-sh/bump-cli
|
166
|
-
post_install_message:
|
184
|
+
post_install_message:
|
167
185
|
rdoc_options: []
|
168
186
|
require_paths:
|
169
187
|
- lib
|
@@ -178,9 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
196
|
- !ruby/object:Gem::Version
|
179
197
|
version: '0'
|
180
198
|
requirements: []
|
181
|
-
|
182
|
-
|
183
|
-
signing_key:
|
199
|
+
rubygems_version: 3.1.2
|
200
|
+
signing_key:
|
184
201
|
specification_version: 4
|
185
202
|
summary: Bump.sh CLI
|
186
203
|
test_files: []
|