uffizzi-cli 0.4.0 → 0.5.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/README.md +4 -0
- data/config/uffizzi.rb +1 -0
- data/lib/uffizzi/cli/common.rb +2 -2
- data/lib/uffizzi/cli/config.rb +3 -3
- data/lib/uffizzi/cli/connect.rb +22 -0
- data/lib/uffizzi/cli/disconnect.rb +3 -0
- data/lib/uffizzi/cli/logout.rb +4 -0
- data/lib/uffizzi/cli/preview/service.rb +2 -2
- data/lib/uffizzi/cli/preview.rb +38 -34
- data/lib/uffizzi/cli/project/compose.rb +2 -2
- data/lib/uffizzi/cli/project/secret.rb +7 -6
- data/lib/uffizzi/cli.rb +28 -9
- data/lib/uffizzi/shell.rb +27 -2
- data/lib/uffizzi/version.rb +1 -1
- data/man/uffizzi +51 -0
- data/man/uffizzi-login +32 -0
- data/man/uffizzi-login.html +113 -0
- data/man/uffizzi-login.ronn +24 -0
- data/man/uffizzi-logout +21 -0
- data/man/uffizzi-logout.html +102 -0
- data/man/uffizzi-logout.ronn +19 -0
- data/man/uffizzi-preview +39 -0
- data/man/uffizzi-preview-create +50 -0
- data/man/uffizzi-preview-create.html +128 -0
- data/man/uffizzi-preview-create.ronn +41 -0
- data/man/uffizzi-preview-delete +37 -0
- data/man/uffizzi-preview-delete.html +115 -0
- data/man/uffizzi-preview-delete.ronn +28 -0
- data/man/uffizzi-preview-describe +38 -0
- data/man/uffizzi-preview-describe.html +116 -0
- data/man/uffizzi-preview-describe.ronn +29 -0
- data/man/uffizzi-preview-events +37 -0
- data/man/uffizzi-preview-events.html +110 -0
- data/man/uffizzi-preview-events.ronn +28 -0
- data/man/uffizzi-preview-list +33 -0
- data/man/uffizzi-preview-list.html +110 -0
- data/man/uffizzi-preview-list.ronn +25 -0
- data/man/uffizzi-preview-service-list +38 -0
- data/man/uffizzi-preview-service-list.ronn +29 -0
- data/man/uffizzi-preview-service-logs +57 -0
- data/man/uffizzi-preview-service-logs.ronn +47 -0
- data/man/uffizzi-preview.html +120 -0
- data/man/uffizzi-preview.ronn +33 -0
- data/man/uffizzi-preview_service_logs +57 -0
- data/man/uffizzi-preview_service_logs.html +142 -0
- data/man/uffizzi-preview_service_logs.ronn +49 -0
- data/man/uffizzi-project +47 -0
- data/man/uffizzi-project-compose +40 -0
- data/man/uffizzi-project-compose-describe +37 -0
- data/man/uffizzi-project-compose-describe.html +118 -0
- data/man/uffizzi-project-compose-describe.ronn +29 -0
- data/man/uffizzi-project-compose-set +66 -0
- data/man/uffizzi-project-compose-set.html +149 -0
- data/man/uffizzi-project-compose-set.ronn +57 -0
- data/man/uffizzi-project-compose-unset +35 -0
- data/man/uffizzi-project-compose-unset.html +116 -0
- data/man/uffizzi-project-compose-unset.ronn +27 -0
- data/man/uffizzi-project-compose.html +123 -0
- data/man/uffizzi-project-compose.ronn +34 -0
- data/man/uffizzi-project-secret +37 -0
- data/man/uffizzi-project-secret-create +29 -0
- data/man/uffizzi-project-secret-create.html +110 -0
- data/man/uffizzi-project-secret-create.ronn +21 -0
- data/man/uffizzi-project-secret-delete +29 -0
- data/man/uffizzi-project-secret-delete.html +110 -0
- data/man/uffizzi-project-secret-delete.ronn +21 -0
- data/man/uffizzi-project-secret-list +28 -0
- data/man/uffizzi-project-secret-list.html +110 -0
- data/man/uffizzi-project-secret-list.ronn +20 -0
- data/man/uffizzi-project-secret.html +119 -0
- data/man/uffizzi-project-secret.ronn +30 -0
- data/man/uffizzi-project.html +128 -0
- data/man/uffizzi-project.ronn +41 -0
- data/man/uffizzi.html +132 -0
- data/man/uffizzi.ronn +43 -0
- metadata +63 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: beaa38102ec282e48c643ba8f6a8c80a331d6ded1760681a004341e2b671b5cf
|
|
4
|
+
data.tar.gz: c6517ea90506e72c11cb244f02f00760d5bb2afa1171f48fc9a997a8489165f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2736a387fb65e9efe83fda0311f9f79bf4916bc828e9b6113bbf7e4e407256438e607af8f1f46dc6df1fa43423ba4728f6432396b60e06c24e16270024382f7a
|
|
7
|
+
data.tar.gz: 53b0f5951c72ebfba472e147e4397d311380b051baf41d3ca2c7e20f894a3ea417406f4ac8fbc3063902a79c7e11f1e39d5246aee0505377b01583d733056914
|
data/README.md
CHANGED
|
@@ -186,6 +186,10 @@ Deletes credential of specified type
|
|
|
186
186
|
|
|
187
187
|
Supported credential types - `docker-hub`, `acr`, `ecr`, `gcr`
|
|
188
188
|
|
|
189
|
+
## Generate manual
|
|
190
|
+
|
|
191
|
+
In order to generate a manual, create a `.ronn` file having a name pattern like `uffizzi-{command-name}` (for example `uffizzi-project-compose`) in the `man` directory and run `bundle exec ronn man/{filename}.ronn`
|
|
192
|
+
|
|
189
193
|
## Git workflow for the app:
|
|
190
194
|
|
|
191
195
|
1. Clone the repository and checkout to `develop` branch
|
data/config/uffizzi.rb
CHANGED
data/lib/uffizzi/cli/common.rb
CHANGED
|
@@ -5,8 +5,8 @@ require 'open3'
|
|
|
5
5
|
module Cli
|
|
6
6
|
class Common
|
|
7
7
|
class << self
|
|
8
|
-
def show_manual(
|
|
9
|
-
manual_doc_path = "man
|
|
8
|
+
def show_manual(command_name)
|
|
9
|
+
manual_doc_path = "man/#{command_name}"
|
|
10
10
|
|
|
11
11
|
Open3.pipeline("man #{manual_doc_path}")
|
|
12
12
|
end
|
data/lib/uffizzi/cli/config.rb
CHANGED
|
@@ -12,17 +12,17 @@ module Uffizzi
|
|
|
12
12
|
run('list')
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
desc 'get', 'get'
|
|
15
|
+
desc 'get [PROPERTY]', 'get'
|
|
16
16
|
def get(property)
|
|
17
17
|
run('get', property)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
desc 'set', 'set'
|
|
20
|
+
desc 'set [PROPERTY] [VALUE]', 'set'
|
|
21
21
|
def set(property, value)
|
|
22
22
|
run('set', property, value)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
desc 'delete', 'delete'
|
|
25
|
+
desc 'delete [PROPERTY]', 'delete'
|
|
26
26
|
def delete(property)
|
|
27
27
|
run('delete', property)
|
|
28
28
|
end
|
data/lib/uffizzi/cli/connect.rb
CHANGED
|
@@ -14,6 +14,8 @@ module Uffizzi
|
|
|
14
14
|
handle_azure
|
|
15
15
|
when 'ecr'
|
|
16
16
|
handle_amazon
|
|
17
|
+
when 'ghcr'
|
|
18
|
+
handle_github_container_registry
|
|
17
19
|
when 'gcr'
|
|
18
20
|
handle_google(credential_file_path)
|
|
19
21
|
else
|
|
@@ -111,6 +113,26 @@ module Uffizzi
|
|
|
111
113
|
end
|
|
112
114
|
end
|
|
113
115
|
|
|
116
|
+
def handle_github_container_registry
|
|
117
|
+
username = Uffizzi.ui.ask('Github Username: ')
|
|
118
|
+
password = Uffizzi.ui.ask('Access Token: ', echo: false)
|
|
119
|
+
|
|
120
|
+
params = {
|
|
121
|
+
username: username,
|
|
122
|
+
password: password,
|
|
123
|
+
type: Uffizzi.configuration.credential_types[:github_container_registry],
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
hostname = ConfigFile.read_option(:hostname)
|
|
127
|
+
response = create_credential(hostname, params)
|
|
128
|
+
|
|
129
|
+
if ResponseHelper.created?(response)
|
|
130
|
+
print_success_message('GitHub Container Registry')
|
|
131
|
+
else
|
|
132
|
+
ResponseHelper.handle_failed_response(response)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
114
136
|
def prepare_registry_url(registry_url)
|
|
115
137
|
return registry_url if registry_url.match?(/^(?:http(s)?:\/\/)/)
|
|
116
138
|
|
|
@@ -16,6 +16,8 @@ module Uffizzi
|
|
|
16
16
|
Uffizzi.configuration.credential_types[:amazon]
|
|
17
17
|
when 'gcr'
|
|
18
18
|
Uffizzi.configuration.credential_types[:google]
|
|
19
|
+
when 'ghcr'
|
|
20
|
+
Uffizzi.configuration.credential_types[:github_container_registry]
|
|
19
21
|
else
|
|
20
22
|
raise Uffizzi::Error.new('Unsupported credential type.')
|
|
21
23
|
end
|
|
@@ -37,6 +39,7 @@ module Uffizzi
|
|
|
37
39
|
'acr' => 'ACR',
|
|
38
40
|
'ecr' => 'ECR',
|
|
39
41
|
'gcr' => 'GCR',
|
|
42
|
+
'ghcr' => 'GHCR',
|
|
40
43
|
}[credential_type]
|
|
41
44
|
end
|
|
42
45
|
end
|
data/lib/uffizzi/cli/logout.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Uffizzi
|
|
|
9
9
|
class CLI::Preview::Service < Thor
|
|
10
10
|
include ApiClient
|
|
11
11
|
|
|
12
|
-
desc '
|
|
12
|
+
desc 'logs [LOGS_TYPE] [DEPLOYMENT_ID] [CONTAINER_NAME]', 'logs'
|
|
13
13
|
def logs(logs_type, deployment_name, container_name = args)
|
|
14
14
|
return Uffizzi.ui.say('You are not logged in.') unless Uffizzi::AuthHelper.signed_in?
|
|
15
15
|
return Uffizzi.ui.say('This command needs project to be set in config file') unless Uffizzi::AuthHelper.project_set?
|
|
@@ -25,7 +25,7 @@ module Uffizzi
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
desc '
|
|
28
|
+
desc 'logs [DEPLOYMENT_ID]', 'list'
|
|
29
29
|
def list(deployment_name)
|
|
30
30
|
return Uffizzi.ui.say('You are not logged in.') unless Uffizzi::AuthHelper.signed_in?
|
|
31
31
|
return Uffizzi.ui.say('This command needs project to be set in config file') unless Uffizzi::AuthHelper.project_set?
|
data/lib/uffizzi/cli/preview.rb
CHANGED
|
@@ -10,56 +10,45 @@ module Uffizzi
|
|
|
10
10
|
|
|
11
11
|
@spinner
|
|
12
12
|
|
|
13
|
-
class << self
|
|
14
|
-
def help(_shell, _subcommand)
|
|
15
|
-
Cli::Common.show_manual(:preview)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
13
|
desc 'service', 'service'
|
|
20
14
|
require_relative 'preview/service'
|
|
21
15
|
subcommand 'service', Uffizzi::CLI::Preview::Service
|
|
22
16
|
|
|
23
17
|
desc 'list', 'list'
|
|
24
18
|
def list
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
run(options, 'list')
|
|
19
|
+
run('list')
|
|
28
20
|
end
|
|
29
21
|
|
|
30
|
-
desc 'create', 'create'
|
|
22
|
+
desc 'create [COMPOSE_FILE]', 'create'
|
|
23
|
+
method_option :output, required: false, type: :string, aliases: '-o', enum: ['json', 'github-action']
|
|
31
24
|
def create(file_path = nil)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
run(options, 'create', file_path: file_path)
|
|
25
|
+
run('create', file_path: file_path)
|
|
35
26
|
end
|
|
36
27
|
|
|
37
|
-
desc 'delete', 'delete'
|
|
28
|
+
desc 'delete [DEPLOYMENT_ID]', 'delete'
|
|
38
29
|
def delete(deployment_name)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
run(options, 'delete', deployment_name: deployment_name)
|
|
30
|
+
run('delete', deployment_name: deployment_name)
|
|
42
31
|
end
|
|
43
32
|
|
|
44
|
-
desc 'describe', 'describe'
|
|
33
|
+
desc 'describe [DEPLOYMENT_ID]', 'describe'
|
|
45
34
|
def describe(deployment_name)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
run(options, 'describe', deployment_name: deployment_name)
|
|
35
|
+
run('describe', deployment_name: deployment_name)
|
|
49
36
|
end
|
|
50
37
|
|
|
51
|
-
desc 'events', 'events'
|
|
38
|
+
desc 'events [DEPLOYMENT_ID]', 'events'
|
|
52
39
|
def events(deployment_name)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
run(options, 'events', deployment_name: deployment_name)
|
|
40
|
+
run('events', deployment_name: deployment_name)
|
|
56
41
|
end
|
|
57
42
|
|
|
58
43
|
private
|
|
59
44
|
|
|
60
|
-
def run(
|
|
61
|
-
|
|
62
|
-
|
|
45
|
+
def run(command, file_path: nil, deployment_name: nil)
|
|
46
|
+
unless options[:output].nil?
|
|
47
|
+
Uffizzi.ui.output_format = options[:output]
|
|
48
|
+
Uffizzi.ui.disable_stdout
|
|
49
|
+
end
|
|
50
|
+
raise Uffizzi::Error.new('You are not logged in.') unless Uffizzi::AuthHelper.signed_in?
|
|
51
|
+
raise Uffizzi::Error.new('This command needs project to be set in config file') unless Uffizzi::AuthHelper.project_set?
|
|
63
52
|
|
|
64
53
|
project_slug = options[:project].nil? ? ConfigFile.read_option(:project) : options[:project]
|
|
65
54
|
|
|
@@ -161,6 +150,19 @@ module Uffizzi
|
|
|
161
150
|
|
|
162
151
|
containers_spinners = create_containers_spinners(activity_items)
|
|
163
152
|
|
|
153
|
+
wait_containers_deploying(project_slug, deployment_id, containers_spinners)
|
|
154
|
+
|
|
155
|
+
if options[:output].nil?
|
|
156
|
+
Uffizzi.ui.say('Done')
|
|
157
|
+
preview_url = "https://#{deployment[:preview_url]}"
|
|
158
|
+
Uffizzi.ui.say(preview_url) if @spinner.success?
|
|
159
|
+
else
|
|
160
|
+
output_data = build_output_data(deployment)
|
|
161
|
+
Uffizzi.ui.output(output_data)
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def wait_containers_deploying(project_slug, deployment_id, containers_spinners)
|
|
164
166
|
loop do
|
|
165
167
|
response = get_activity_items(ConfigFile.read_option(:hostname), project_slug, deployment_id)
|
|
166
168
|
handle_activity_items_response(response)
|
|
@@ -172,10 +174,6 @@ module Uffizzi
|
|
|
172
174
|
|
|
173
175
|
sleep(5)
|
|
174
176
|
end
|
|
175
|
-
|
|
176
|
-
Uffizzi.ui.say('Done')
|
|
177
|
-
preview_url = "http://#{deployment[:preview_url]}"
|
|
178
|
-
Uffizzi.ui.say(preview_url) if @spinner.success?
|
|
179
177
|
end
|
|
180
178
|
|
|
181
179
|
def create_containers_spinners(activity_items)
|
|
@@ -264,8 +262,7 @@ module Uffizzi
|
|
|
264
262
|
begin
|
|
265
263
|
compose_file_data = File.read(file_path)
|
|
266
264
|
rescue Errno::ENOENT => e
|
|
267
|
-
Uffizzi.
|
|
268
|
-
return
|
|
265
|
+
raise Uffizzi::Error.new(e.message)
|
|
269
266
|
end
|
|
270
267
|
|
|
271
268
|
compose_file_dir = File.dirname(file_path)
|
|
@@ -282,5 +279,12 @@ module Uffizzi
|
|
|
282
279
|
dependencies: dependencies,
|
|
283
280
|
}
|
|
284
281
|
end
|
|
282
|
+
|
|
283
|
+
def build_output_data(output_data)
|
|
284
|
+
{
|
|
285
|
+
id: "deployment-#{output_data[:id]}",
|
|
286
|
+
url: "https://#{output_data[:preview_url]}",
|
|
287
|
+
}
|
|
288
|
+
end
|
|
285
289
|
end
|
|
286
290
|
end
|
|
@@ -10,7 +10,7 @@ module Uffizzi
|
|
|
10
10
|
class CLI::Project::Compose < Thor
|
|
11
11
|
include ApiClient
|
|
12
12
|
|
|
13
|
-
desc 'set', 'set'
|
|
13
|
+
desc 'set [OPTIONS]', 'set'
|
|
14
14
|
def set
|
|
15
15
|
run(options, 'set')
|
|
16
16
|
end
|
|
@@ -96,7 +96,7 @@ module Uffizzi
|
|
|
96
96
|
begin
|
|
97
97
|
compose_file_data = EnvVariablesService.substitute_env_variables(File.read(file_path))
|
|
98
98
|
rescue Errno::ENOENT => e
|
|
99
|
-
|
|
99
|
+
raise Uffizzi::Error.new(e.message)
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
compose_file_dir = File.dirname(file_path)
|
|
@@ -14,19 +14,20 @@ module Uffizzi
|
|
|
14
14
|
run('list')
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
desc 'create', 'Create secrets'
|
|
17
|
+
desc 'create [SECRET_ID]', 'Create secrets from $stdout'
|
|
18
18
|
def create(id)
|
|
19
19
|
run('create', id)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
desc 'delete', 'Delete a secret'
|
|
22
|
+
desc 'delete [SECRET_ID]', 'Delete a secret'
|
|
23
23
|
def delete(id)
|
|
24
24
|
run('delete', id)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
private
|
|
28
28
|
|
|
29
|
-
def run(command,
|
|
29
|
+
def run(command, id = nil)
|
|
30
|
+
Cli::Common.show_manual(:project, :secret, command) if options[:help] || args.include?('help')
|
|
30
31
|
return Uffizzi.ui.say('You are not logged in') unless AuthHelper.signed_in?
|
|
31
32
|
|
|
32
33
|
project_slug = ConfigFile.read_option(:project)
|
|
@@ -36,13 +37,13 @@ module Uffizzi
|
|
|
36
37
|
when 'list'
|
|
37
38
|
handle_list_command(project_slug)
|
|
38
39
|
when 'create'
|
|
39
|
-
handle_create_command(project_slug,
|
|
40
|
+
handle_create_command(project_slug, id)
|
|
40
41
|
when 'delete'
|
|
41
|
-
handle_delete_command(project_slug,
|
|
42
|
+
handle_delete_command(project_slug, id)
|
|
42
43
|
else
|
|
43
44
|
error_message = "The subcommand #{command} does not exist, please run 'uffizzi project secret help' \
|
|
44
45
|
to get the list of available subcommands"
|
|
45
|
-
|
|
46
|
+
raise Thor::Error.new(error_message)
|
|
46
47
|
end
|
|
47
48
|
end
|
|
48
49
|
|
data/lib/uffizzi/cli.rb
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'thor'
|
|
4
3
|
require 'uffizzi'
|
|
5
4
|
|
|
6
5
|
module Uffizzi
|
|
7
6
|
class CLI < Thor
|
|
8
|
-
require_relative 'cli/common'
|
|
9
|
-
class_option :help, type: :boolean, aliases: ['-h', 'help']
|
|
10
|
-
|
|
11
7
|
def self.exit_on_failure?
|
|
12
8
|
true
|
|
13
9
|
end
|
|
@@ -18,7 +14,7 @@ module Uffizzi
|
|
|
18
14
|
Uffizzi.ui.say(Uffizzi::VERSION)
|
|
19
15
|
end
|
|
20
16
|
|
|
21
|
-
desc 'login', 'Login into Uffizzi'
|
|
17
|
+
desc 'login [OPTIONS]', 'Login into Uffizzi'
|
|
22
18
|
method_option :user, required: true, aliases: '-u'
|
|
23
19
|
method_option :hostname, required: true
|
|
24
20
|
def login
|
|
@@ -27,11 +23,9 @@ module Uffizzi
|
|
|
27
23
|
end
|
|
28
24
|
|
|
29
25
|
desc 'logout', 'Logout from Uffizzi'
|
|
30
|
-
def logout
|
|
31
|
-
return Cli::Common.show_manual(:logout) if help || options[:help]
|
|
32
|
-
|
|
26
|
+
def logout
|
|
33
27
|
require_relative 'cli/logout'
|
|
34
|
-
Logout.new.run
|
|
28
|
+
Logout.new(options).run
|
|
35
29
|
end
|
|
36
30
|
|
|
37
31
|
desc 'projects', 'projects'
|
|
@@ -64,5 +58,30 @@ module Uffizzi
|
|
|
64
58
|
require_relative 'cli/disconnect'
|
|
65
59
|
Disconnect.new.run(credential_type)
|
|
66
60
|
end
|
|
61
|
+
|
|
62
|
+
class << self
|
|
63
|
+
protected
|
|
64
|
+
|
|
65
|
+
def dispatch(meth, given_args, given_opts, config)
|
|
66
|
+
args, opts = Thor::Options.split(given_args)
|
|
67
|
+
return Cli::Common.show_manual(filename(args)) if show_help?(args, opts)
|
|
68
|
+
|
|
69
|
+
super
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def filename(args)
|
|
75
|
+
args_without_help = args.reject { |arg| arg == 'help' }
|
|
76
|
+
return 'uffizzi' if args_without_help.empty?
|
|
77
|
+
|
|
78
|
+
"uffizzi-#{args_without_help.join('-')}"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def show_help?(args, opts)
|
|
82
|
+
help_options = ['--help', '-h', '--help=true']
|
|
83
|
+
args.empty? || args.include?('help') || opts.any? { |opt| help_options.include?(opt) }
|
|
84
|
+
end
|
|
85
|
+
end
|
|
67
86
|
end
|
|
68
87
|
end
|
data/lib/uffizzi/shell.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'thor'
|
|
4
|
-
|
|
5
3
|
module Uffizzi
|
|
6
4
|
module UI
|
|
7
5
|
class Shell
|
|
6
|
+
attr_accessor :output_format
|
|
7
|
+
|
|
8
8
|
def initialize
|
|
9
9
|
@shell = Thor::Shell::Basic.new
|
|
10
10
|
end
|
|
@@ -28,6 +28,31 @@ module Uffizzi
|
|
|
28
28
|
def last_message
|
|
29
29
|
@shell.send(:stdout).string.strip
|
|
30
30
|
end
|
|
31
|
+
|
|
32
|
+
def disable_stdout
|
|
33
|
+
$stdout = StringIO.new
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def output(data)
|
|
37
|
+
$stdout = IO.new(1, 'w')
|
|
38
|
+
json_format? ? output_in_json(data) : output_in_github_format(data)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def json_format?
|
|
44
|
+
output_format == 'json'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def output_in_json(data)
|
|
48
|
+
say(data.to_json)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def output_in_github_format(data)
|
|
52
|
+
data.each_key do |key|
|
|
53
|
+
say("::set-output name=#{key}::#{data[key]}")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
31
56
|
end
|
|
32
57
|
end
|
|
33
58
|
end
|
data/lib/uffizzi/version.rb
CHANGED
data/man/uffizzi
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.\" generated with Ronn-NG/v0.9.1
|
|
2
|
+
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
|
3
|
+
.TH "UFFIZZI" "" "April 2022" ""
|
|
4
|
+
.SH "NAME"
|
|
5
|
+
\fBuffizzi\fR \- manage Uffizzi resources
|
|
6
|
+
.SH "SYNOPSIS"
|
|
7
|
+
.nf
|
|
8
|
+
uffizzi GROUP | COMMAND
|
|
9
|
+
.fi
|
|
10
|
+
.SH "DESCRIPTION"
|
|
11
|
+
.nf
|
|
12
|
+
The uffizzi CLI manages authentication, configuration, and
|
|
13
|
+
interaction with Uffizzi APIs\.
|
|
14
|
+
|
|
15
|
+
For more information on the uffizzi CLI, see:
|
|
16
|
+
https://docs\.uffizzi\.com/cli
|
|
17
|
+
.fi
|
|
18
|
+
.SH "GROUP"
|
|
19
|
+
.nf
|
|
20
|
+
GROUP is one of the following:
|
|
21
|
+
|
|
22
|
+
config
|
|
23
|
+
Configure the uffizzi CLI
|
|
24
|
+
|
|
25
|
+
connect
|
|
26
|
+
Grant a Uffizzi user account access to external services
|
|
27
|
+
|
|
28
|
+
preview
|
|
29
|
+
Manage Uffizzi previews and view logs
|
|
30
|
+
|
|
31
|
+
project
|
|
32
|
+
Manage Uffizzi project resources including compose files for
|
|
33
|
+
specifying preview configurations and secrets
|
|
34
|
+
.fi
|
|
35
|
+
.SH "COMMAND"
|
|
36
|
+
.nf
|
|
37
|
+
COMMAND is one of the following:
|
|
38
|
+
|
|
39
|
+
help
|
|
40
|
+
Show uffizzi documentation
|
|
41
|
+
|
|
42
|
+
login
|
|
43
|
+
Log in to a Uffizzi user account
|
|
44
|
+
|
|
45
|
+
logout
|
|
46
|
+
Log out of a Uffizzi user account
|
|
47
|
+
|
|
48
|
+
version
|
|
49
|
+
Print version information for uffizzi CLI
|
|
50
|
+
.fi
|
|
51
|
+
|
data/man/uffizzi-login
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.\" generated with Ronn-NG/v0.9.1
|
|
2
|
+
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
|
3
|
+
.TH "UFFIZZI\-LOGIN" "" "April 2022" ""
|
|
4
|
+
.SH "NAME"
|
|
5
|
+
\fBuffizzi\-login\fR \- login to Uffizzi
|
|
6
|
+
.SH "SYNOPSIS"
|
|
7
|
+
.nf
|
|
8
|
+
uffizzi login [UFFIZZI_WIDE_FLAG \|\.\|\.\|\.]
|
|
9
|
+
.fi
|
|
10
|
+
.SH "DESCRIPTION"
|
|
11
|
+
.nf
|
|
12
|
+
The uffizzi login command lets you authenticate with Uffizzi\.
|
|
13
|
+
|
|
14
|
+
For more information on authentication and credential types, see:
|
|
15
|
+
https://docs\.uffizzi\.com/references/cli
|
|
16
|
+
.fi
|
|
17
|
+
.SH "UFFIZZI WIDE FLAGS"
|
|
18
|
+
.nf
|
|
19
|
+
These flags are available to all commands: \-\-project\. Run $ uffizzi
|
|
20
|
+
help for details\.
|
|
21
|
+
.fi
|
|
22
|
+
.SH "EXAMPLES"
|
|
23
|
+
.nf
|
|
24
|
+
To login to the default host with the default user account, run:
|
|
25
|
+
|
|
26
|
+
$ uffizzi login
|
|
27
|
+
|
|
28
|
+
To login to an alternate host, run:
|
|
29
|
+
|
|
30
|
+
$ uffizzi login \-\-hostname=uffizzi\.example\.com
|
|
31
|
+
.fi
|
|
32
|
+
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv='content-type' content='text/html;charset=utf8'>
|
|
5
|
+
<meta name='generator' content='Ronn-NG/v0.9.1 (http://github.com/apjanke/ronn-ng/tree/0.9.1)'>
|
|
6
|
+
<title>uffizzi-login</title>
|
|
7
|
+
<style type='text/css' media='all'>
|
|
8
|
+
/* style: man */
|
|
9
|
+
body#manpage {margin:0}
|
|
10
|
+
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
|
11
|
+
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
|
12
|
+
.mp h2 {margin:10px 0 0 0}
|
|
13
|
+
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
|
14
|
+
.mp h3 {margin:0 0 0 4ex}
|
|
15
|
+
.mp dt {margin:0;clear:left}
|
|
16
|
+
.mp dt.flush {float:left;width:8ex}
|
|
17
|
+
.mp dd {margin:0 0 0 9ex}
|
|
18
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
|
19
|
+
.mp pre {margin-bottom:20px}
|
|
20
|
+
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
|
21
|
+
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
|
22
|
+
.mp img {display:block;margin:auto}
|
|
23
|
+
.mp h1.man-title {display:none}
|
|
24
|
+
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
|
25
|
+
.mp h2 {font-size:16px;line-height:1.25}
|
|
26
|
+
.mp h1 {font-size:20px;line-height:2}
|
|
27
|
+
.mp {text-align:justify;background:#fff}
|
|
28
|
+
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
|
29
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
|
30
|
+
.mp u {text-decoration:underline}
|
|
31
|
+
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
|
32
|
+
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
|
33
|
+
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
|
34
|
+
.mp b.man-ref {font-weight:normal;color:#434241}
|
|
35
|
+
.mp pre {padding:0 4ex}
|
|
36
|
+
.mp pre code {font-weight:normal;color:#434241}
|
|
37
|
+
.mp h2+pre,h3+pre {padding-left:0}
|
|
38
|
+
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
|
39
|
+
ol.man-decor {width:100%}
|
|
40
|
+
ol.man-decor li.tl {text-align:left}
|
|
41
|
+
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
|
42
|
+
ol.man-decor li.tr {text-align:right;float:right}
|
|
43
|
+
</style>
|
|
44
|
+
</head>
|
|
45
|
+
<!--
|
|
46
|
+
The following styles are deprecated and will be removed at some point:
|
|
47
|
+
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
|
48
|
+
|
|
49
|
+
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
|
50
|
+
.man-navigation should be used instead.
|
|
51
|
+
-->
|
|
52
|
+
<body id='manpage'>
|
|
53
|
+
<div class='mp' id='man'>
|
|
54
|
+
|
|
55
|
+
<div class='man-navigation' style='display:none'>
|
|
56
|
+
<a href="#NAME">NAME</a>
|
|
57
|
+
<a href="#NAME">NAME</a>
|
|
58
|
+
<a href="#SYNOPSIS">SYNOPSIS</a>
|
|
59
|
+
<a href="#DESCRIPTION">DESCRIPTION</a>
|
|
60
|
+
<a href="#UFFIZZI-WIDE-FLAGS">UFFIZZI WIDE FLAGS</a>
|
|
61
|
+
<a href="#EXAMPLES">EXAMPLES</a>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<ol class='man-decor man-head man head'>
|
|
65
|
+
<li class='tl'>uffizzi-login</li>
|
|
66
|
+
<li class='tc'></li>
|
|
67
|
+
<li class='tr'>uffizzi-login</li>
|
|
68
|
+
</ol>
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
<h2 id="NAME">NAME</h2>
|
|
72
|
+
<p class="man-name">
|
|
73
|
+
<code>uffizzi-login</code>
|
|
74
|
+
</p>
|
|
75
|
+
<h2 id="NAME">NAME</h2>
|
|
76
|
+
<pre><code>uffizzi login - login to Uffizzi
|
|
77
|
+
</code></pre>
|
|
78
|
+
|
|
79
|
+
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
|
80
|
+
<pre><code>uffizzi login [UFFIZZI_WIDE_FLAG ...]
|
|
81
|
+
</code></pre>
|
|
82
|
+
|
|
83
|
+
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
|
84
|
+
<pre><code>The uffizzi login command lets you authenticate with Uffizzi.
|
|
85
|
+
|
|
86
|
+
For more information on authentication and credential types, see:
|
|
87
|
+
https://docs.uffizzi.com/references/cli
|
|
88
|
+
</code></pre>
|
|
89
|
+
|
|
90
|
+
<h2 id="UFFIZZI-WIDE-FLAGS">UFFIZZI WIDE FLAGS</h2>
|
|
91
|
+
<pre><code>These flags are available to all commands: --project. Run $ uffizzi
|
|
92
|
+
help for details.
|
|
93
|
+
</code></pre>
|
|
94
|
+
|
|
95
|
+
<h2 id="EXAMPLES">EXAMPLES</h2>
|
|
96
|
+
<pre><code>To login to the default host with the default user account, run:
|
|
97
|
+
|
|
98
|
+
$ uffizzi login
|
|
99
|
+
|
|
100
|
+
To login to an alternate host, run:
|
|
101
|
+
|
|
102
|
+
$ uffizzi login --hostname=uffizzi.example.com
|
|
103
|
+
</code></pre>
|
|
104
|
+
|
|
105
|
+
<ol class='man-decor man-foot man foot'>
|
|
106
|
+
<li class='tl'></li>
|
|
107
|
+
<li class='tc'>March 2022</li>
|
|
108
|
+
<li class='tr'>uffizzi-login</li>
|
|
109
|
+
</ol>
|
|
110
|
+
|
|
111
|
+
</div>
|
|
112
|
+
</body>
|
|
113
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
uffizzi-login - login to Uffizzi
|
|
2
|
+
================================================================
|
|
3
|
+
|
|
4
|
+
## SYNOPSIS
|
|
5
|
+
uffizzi login [UFFIZZI_WIDE_FLAG ...]
|
|
6
|
+
|
|
7
|
+
## DESCRIPTION
|
|
8
|
+
The uffizzi login command lets you authenticate with Uffizzi.
|
|
9
|
+
|
|
10
|
+
For more information on authentication and credential types, see:
|
|
11
|
+
https://docs.uffizzi.com/references/cli
|
|
12
|
+
|
|
13
|
+
## UFFIZZI WIDE FLAGS
|
|
14
|
+
These flags are available to all commands: --project. Run $ uffizzi
|
|
15
|
+
help for details.
|
|
16
|
+
|
|
17
|
+
## EXAMPLES
|
|
18
|
+
To login to the default host with the default user account, run:
|
|
19
|
+
|
|
20
|
+
$ uffizzi login
|
|
21
|
+
|
|
22
|
+
To login to an alternate host, run:
|
|
23
|
+
|
|
24
|
+
$ uffizzi login --hostname=uffizzi.example.com
|