uffizzi-cli 1.0.0 → 1.0.1
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/uffizzi/cli/preview.rb +13 -12
- data/lib/uffizzi/shell.rb +24 -15
- data/lib/uffizzi/version.rb +1 -1
- data/man/uffizzi-preview-list +3 -3
- data/man/uffizzi-preview-list.ronn +2 -2
- 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: 88f0a01cdfea0ed8e8d4ad54d776f517f84d74c424f2db15569fb788e7fe3868
|
4
|
+
data.tar.gz: e690fe7b2552ae4215687aac32420cb4b39e3cd2dd4b1d4fcf723538e49b213c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77198a935bf13d106bd191e017094ecc431cc09e307608a4f23ccd3bbd5591b7d12def5f4c3eff77f0389acfe6384f2a80ad63389d7ce8b7f51b9768d8bd0d09
|
7
|
+
data.tar.gz: c945bf73973d7a55fae9e3cf9502a1cfacafc65671b292913333c61f644fe0ca9c5402e7ae7ce54ae88bd08de117e016614d72e9474634ff725581828ea288bb
|
data/lib/uffizzi/cli/preview.rb
CHANGED
@@ -15,7 +15,7 @@ module Uffizzi
|
|
15
15
|
|
16
16
|
desc 'list', 'List all previews'
|
17
17
|
method_option :filter, required: false, type: :string, aliases: '-f'
|
18
|
-
method_option :output, required: false, type: :string, aliases: '-o', enum: ['json']
|
18
|
+
method_option :output, required: false, type: :string, aliases: '-o', enum: ['json', 'pretty-json']
|
19
19
|
def list
|
20
20
|
run('list')
|
21
21
|
end
|
@@ -87,6 +87,7 @@ module Uffizzi
|
|
87
87
|
|
88
88
|
def handle_create_command(file_path, project_slug, labels)
|
89
89
|
Uffizzi.ui.disable_stdout unless options[:output].nil?
|
90
|
+
|
90
91
|
params = prepare_params(file_path, labels)
|
91
92
|
|
92
93
|
response = create_deployment(ConfigFile.read_option(:server), project_slug, params)
|
@@ -145,7 +146,8 @@ module Uffizzi
|
|
145
146
|
end
|
146
147
|
|
147
148
|
def handle_succeed_events_response(response)
|
148
|
-
Uffizzi.ui.
|
149
|
+
Uffizzi.ui.output_format = Uffizzi::UI::Shell::PRETTY_JSON
|
150
|
+
Uffizzi.ui.say(response[:body][:events])
|
149
151
|
end
|
150
152
|
|
151
153
|
def handle_delete_command(deployment_name, project_slug)
|
@@ -180,13 +182,12 @@ module Uffizzi
|
|
180
182
|
deployments = response[:body][:deployments] || []
|
181
183
|
raise Uffizzi::Error.new('The project has no active deployments') if deployments.empty?
|
182
184
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
Uffizzi.ui.pretty_say(deployment)
|
188
|
-
end
|
185
|
+
if Uffizzi.ui.output_format.nil?
|
186
|
+
deployments = deployments.reduce('') do |acc, deployment|
|
187
|
+
"#{acc}deployment-#{deployment[:id]}\n"
|
188
|
+
end.strip
|
189
189
|
end
|
190
|
+
Uffizzi.ui.say(deployments)
|
190
191
|
end
|
191
192
|
|
192
193
|
def handle_succeed_delete_response(deployment_id)
|
@@ -202,9 +203,8 @@ module Uffizzi
|
|
202
203
|
|
203
204
|
container
|
204
205
|
end
|
205
|
-
deployment.
|
206
|
-
|
207
|
-
end
|
206
|
+
deployment_data = deployment.reduce('') { |acc, (key, value)| "#{acc}#{key}: #{value}\n" }.strip
|
207
|
+
Uffizzi.ui.say(deployment_data)
|
208
208
|
end
|
209
209
|
|
210
210
|
def hide_secrets(secret_variables)
|
@@ -240,7 +240,8 @@ module Uffizzi
|
|
240
240
|
Uffizzi.ui.say(preview_url) if success
|
241
241
|
else
|
242
242
|
deployment_data = build_deployment_data(deployment)
|
243
|
-
Uffizzi.ui.
|
243
|
+
Uffizzi.ui.enable_stdout
|
244
|
+
Uffizzi.ui.say(deployment_data)
|
244
245
|
end
|
245
246
|
end
|
246
247
|
|
data/lib/uffizzi/shell.rb
CHANGED
@@ -7,12 +7,26 @@ module Uffizzi
|
|
7
7
|
class Shell
|
8
8
|
attr_accessor :output_format
|
9
9
|
|
10
|
+
PRETTY_JSON = 'pretty-json'
|
11
|
+
REGULAR_JSON = 'json'
|
12
|
+
GITHUB_ACTION = 'github-action'
|
13
|
+
|
10
14
|
def initialize
|
11
15
|
@shell = Thor::Shell::Basic.new
|
12
16
|
end
|
13
17
|
|
14
18
|
def say(message)
|
15
|
-
|
19
|
+
formatted_message = case output_format
|
20
|
+
when PRETTY_JSON
|
21
|
+
format_to_pretty_json(message)
|
22
|
+
when REGULAR_JSON
|
23
|
+
format_to_json(message)
|
24
|
+
when GITHUB_ACTION
|
25
|
+
format_to_github_action(message)
|
26
|
+
else
|
27
|
+
message
|
28
|
+
end
|
29
|
+
@shell.say(formatted_message)
|
16
30
|
end
|
17
31
|
|
18
32
|
def print_in_columns(messages)
|
@@ -34,33 +48,28 @@ module Uffizzi
|
|
34
48
|
@shell.send(:stdout).string.strip
|
35
49
|
end
|
36
50
|
|
37
|
-
def pretty_say(collection, index = true)
|
38
|
-
ap(collection, { index: index })
|
39
|
-
end
|
40
|
-
|
41
51
|
def disable_stdout
|
42
52
|
$stdout = StringIO.new
|
43
53
|
end
|
44
54
|
|
45
|
-
def
|
55
|
+
def enable_stdout
|
46
56
|
$stdout = IO.new(1, 'w')
|
47
|
-
json_format? ? output_in_json(data) : output_in_github_format(data)
|
48
57
|
end
|
49
58
|
|
50
59
|
private
|
51
60
|
|
52
|
-
def
|
53
|
-
|
61
|
+
def format_to_json(data)
|
62
|
+
data.to_json
|
54
63
|
end
|
55
64
|
|
56
|
-
def
|
57
|
-
|
65
|
+
def format_to_pretty_json(data)
|
66
|
+
JSON.pretty_generate(data)
|
58
67
|
end
|
59
68
|
|
60
|
-
def
|
61
|
-
data.
|
62
|
-
|
63
|
-
|
69
|
+
def format_to_github_action(data)
|
70
|
+
return '' unless data.is_a?(Hash)
|
71
|
+
|
72
|
+
data.reduce('') { |acc, (key, value)| "#{acc}::set-output name=#{key}::#{value}\n" }
|
64
73
|
end
|
65
74
|
end
|
66
75
|
end
|
data/lib/uffizzi/version.rb
CHANGED
data/man/uffizzi-preview-list
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
.\" generated with Ronn-NG/v0.9.1
|
2
2
|
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
3
|
-
.TH "UFFIZZI\-PREVIEW\-LIST" "" "
|
3
|
+
.TH "UFFIZZI\-PREVIEW\-LIST" "" "September 2022" ""
|
4
4
|
.SH "NAME"
|
5
5
|
\fBuffizzi\-preview\-list\fR \- list previews in a project
|
6
6
|
.SH "SYNOPSIS"
|
@@ -20,7 +20,7 @@ https://github\.com/UffizziCloud/uffizzi_cli
|
|
20
20
|
\-\-filter=METADATA
|
21
21
|
Metadata to filtering list of deployments\.
|
22
22
|
|
23
|
-
\-\-output=json
|
23
|
+
\-\-output=pretty\-json
|
24
24
|
Use this option for a more detailed description of listed
|
25
25
|
deployments\.
|
26
26
|
.fi
|
@@ -41,7 +41,7 @@ To list all previews in a project with name my_project, run:
|
|
41
41
|
|
42
42
|
To list all previews in json format, run:
|
43
43
|
|
44
|
-
$ uffizzi preview list \-\-output="json"
|
44
|
+
$ uffizzi preview list \-\-output="pretty\-json"
|
45
45
|
|
46
46
|
To list all previews filtered by metadata using single
|
47
47
|
label, run:
|
@@ -15,7 +15,7 @@ uffizzi-preview-list - list previews in a project
|
|
15
15
|
--filter=METADATA
|
16
16
|
Metadata to filtering list of deployments.
|
17
17
|
|
18
|
-
--output=json
|
18
|
+
--output=pretty-json
|
19
19
|
Use this option for a more detailed description of listed
|
20
20
|
deployments.
|
21
21
|
|
@@ -34,7 +34,7 @@ uffizzi-preview-list - list previews in a project
|
|
34
34
|
|
35
35
|
To list all previews in json format, run:
|
36
36
|
|
37
|
-
$ uffizzi preview list --output="json"
|
37
|
+
$ uffizzi preview list --output="pretty-json"
|
38
38
|
|
39
39
|
To list all previews filtered by metadata using single
|
40
40
|
label, run:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uffizzi-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Thurman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-08
|
12
|
+
date: 2022-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: awesome_print
|