envirobly 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/envirobly/access_token.rb +1 -1
- data/lib/envirobly/api.rb +9 -1
- data/lib/envirobly/cli/main.rb +6 -17
- data/lib/envirobly/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58cece10b3dc2908e0bce6a78f509463c8261fa34d54c9a45059b95205c494d3
|
4
|
+
data.tar.gz: 71b06913da6f29967a5f779c62a76423f30242474daeda744b34be44f7ba494a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d67d5afc046a25396f822f86d17d584172468e277ff5626efbb1d11fadffdad86e821118b2d8dc0ee89f33b9d316d999fce182f5001be7e7029977aeb3a9604c
|
7
|
+
data.tar.gz: 224f58f13842244a423fbef3ab69540a97969a15c168e09a090f8a8c255340ec65657db6bf680d6c384d2dbda804d51708dc2bc99928ac03785495e00341837f
|
@@ -69,7 +69,7 @@ class Envirobly::AccessToken
|
|
69
69
|
exit
|
70
70
|
end
|
71
71
|
|
72
|
-
api = Envirobly::Api.new(access_token: self)
|
72
|
+
api = Envirobly::Api.new(access_token: self, exit_on_error: false)
|
73
73
|
|
74
74
|
# TODO: Eventually replace with custom `whoami` API that returns name, email...
|
75
75
|
if api.list_accounts.success?
|
data/lib/envirobly/api.rb
CHANGED
@@ -8,7 +8,8 @@ class Envirobly::Api
|
|
8
8
|
USER_AGENT = "Envirobly CLI v#{Envirobly::VERSION}"
|
9
9
|
CONTENT_TYPE = "application/json"
|
10
10
|
|
11
|
-
def initialize(access_token: Envirobly::AccessToken.new)
|
11
|
+
def initialize(access_token: Envirobly::AccessToken.new, exit_on_error: true)
|
12
|
+
@exit_on_error = exit_on_error
|
12
13
|
@access_token = access_token
|
13
14
|
end
|
14
15
|
|
@@ -117,11 +118,18 @@ class Envirobly::Api
|
|
117
118
|
http.request(request).tap do |response|
|
118
119
|
def response.object
|
119
120
|
@json_parsed_body ||= JSON.parse(body)
|
121
|
+
rescue
|
122
|
+
@json_parsed_body = { error_message: body }
|
120
123
|
end
|
121
124
|
|
122
125
|
def response.success?
|
123
126
|
(200..299).include?(code.to_i)
|
124
127
|
end
|
128
|
+
|
129
|
+
if @exit_on_error && !response.success? && response.object[:error_message].present?
|
130
|
+
puts response.object[:error_message] # TODO: Replace with shell.say_error
|
131
|
+
exit 1
|
132
|
+
end
|
125
133
|
end
|
126
134
|
end
|
127
135
|
|
data/lib/envirobly/cli/main.rb
CHANGED
@@ -80,7 +80,8 @@ class Envirobly::Cli::Main < Envirobly::Base
|
|
80
80
|
TXT
|
81
81
|
method_option :account_id, type: :numeric
|
82
82
|
method_option :region, type: :string
|
83
|
-
method_option :
|
83
|
+
method_option :project_id, type: :numeric
|
84
|
+
method_option :project_name, type: :string
|
84
85
|
method_option :commit, type: :string, default: "HEAD"
|
85
86
|
method_option :dry_run, type: :boolean, default: false
|
86
87
|
def deploy(environ_name = nil)
|
@@ -93,31 +94,19 @@ class Envirobly::Cli::Main < Envirobly::Base
|
|
93
94
|
|
94
95
|
Envirobly::AccessToken.new(shell:).require!
|
95
96
|
|
96
|
-
environ_name = environ_name.presence || commit.current_branch
|
97
|
-
project_name = nil
|
98
|
-
project_id = nil
|
99
|
-
|
100
|
-
if options.project.present?
|
101
|
-
if options.project =~ Envirobly::Defaults::Project.regexp
|
102
|
-
project_id = $1.to_i
|
103
|
-
else
|
104
|
-
project_name = options.project
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
97
|
deployment = Envirobly::Deployment.new(
|
109
98
|
account_id: options.account_id,
|
110
99
|
region: options.region,
|
111
|
-
|
112
|
-
|
113
|
-
|
100
|
+
project_id: options.project_id,
|
101
|
+
project_name: options.project_name,
|
102
|
+
environ_name: environ_name.presence || commit.current_branch,
|
114
103
|
commit:,
|
115
104
|
shell:
|
116
105
|
)
|
117
106
|
deployment.perform(dry_run: options.dry_run)
|
118
107
|
end
|
119
108
|
|
120
|
-
desc "pull", "Download build context"
|
109
|
+
desc "pull [REGION] [BUCKET] [REF] [PATH]", "Download build context. Used by Envirobly builders."
|
121
110
|
def pull(region, bucket, ref, path)
|
122
111
|
Envirobly::Duration.measure("Build context download took %s") do
|
123
112
|
s3 = Envirobly::Aws::S3.new(region:, bucket:)
|
data/lib/envirobly/version.rb
CHANGED