uffizzi-cli 0.11.0 → 0.11.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 692eb8af782d78cc92d06d6a0eda07e6d481019a81f44144791bf211ab6438c0
|
4
|
+
data.tar.gz: a0db18ffc332806c013647c0706294c3db9486b42777a8f622fea9ca46552062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97e7dd627b0edfbfb500003480dc0e30e3497f36c263f6ebb2e3a79dced658444432e13182a5b2d3149e41982543283190255118e4eeec393f6c01aaed4dc9d5
|
7
|
+
data.tar.gz: 942031954c139f313f20ae22f47b894131101e32f41b9b5a3001e35fde31b2f45b5b08a6e8791bf8584b8982234274c6295a71c9aa13fceb369495498810cdfb
|
data/lib/uffizzi/cli/login.rb
CHANGED
@@ -15,7 +15,7 @@ module Uffizzi
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def run
|
18
|
-
Uffizzi.ui.say('Login to Uffizzi
|
18
|
+
Uffizzi.ui.say('Login to Uffizzi server.')
|
19
19
|
server = set_server
|
20
20
|
|
21
21
|
username = set_username
|
@@ -68,6 +68,8 @@ module Uffizzi
|
|
68
68
|
ConfigFile.write_option(:cookie, response[:headers])
|
69
69
|
ConfigFile.write_option(:account_id, account[:id])
|
70
70
|
|
71
|
+
Uffizzi.ui.say('Login successfull')
|
72
|
+
|
71
73
|
default_project = ConfigFile.read_option(:project)
|
72
74
|
return unless default_project
|
73
75
|
|
@@ -68,7 +68,7 @@ module Uffizzi
|
|
68
68
|
|
69
69
|
def handle_succeed_logs_response(response, container_name)
|
70
70
|
logs = response[:body][:logs] || []
|
71
|
-
return Uffizzi.ui.say("The service #{container_name} has no logs") if logs.empty?
|
71
|
+
return Uffizzi.ui.say("The service '#{container_name}' has no logs") if logs.empty?
|
72
72
|
|
73
73
|
logs.each do |log|
|
74
74
|
Uffizzi.ui.say(log)
|
data/lib/uffizzi/config_file.rb
CHANGED
@@ -92,10 +92,9 @@ module Uffizzi
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def write(data)
|
95
|
-
file = create_file
|
96
95
|
prepared_data = prepare_data(data)
|
97
|
-
|
98
|
-
|
96
|
+
|
97
|
+
lock(config_path) { atomic_write(config_path, "#{config_path}.tmp", prepared_data) }
|
99
98
|
end
|
100
99
|
|
101
100
|
def prepare_data(data)
|
@@ -105,12 +104,18 @@ module Uffizzi
|
|
105
104
|
end
|
106
105
|
end
|
107
106
|
|
108
|
-
def
|
109
|
-
|
107
|
+
def atomic_write(path, temp_path, content)
|
108
|
+
File.open(temp_path, 'w') { |f| f.write(content) }
|
109
|
+
FileUtils.mv(temp_path, path)
|
110
|
+
end
|
110
111
|
|
112
|
+
def lock(path)
|
113
|
+
dir = File.dirname(path)
|
111
114
|
FileUtils.mkdir_p(dir) unless File.directory?(dir)
|
112
115
|
|
113
|
-
File.
|
116
|
+
File.open(path).flock(File::LOCK_EX) if File.exist?(path)
|
117
|
+
yield
|
118
|
+
File.open(path).flock(File::LOCK_UN)
|
114
119
|
end
|
115
120
|
end
|
116
121
|
end
|
@@ -42,14 +42,18 @@ module Uffizzi
|
|
42
42
|
def prepare_errors(errors)
|
43
43
|
errors.values.reduce('') do |acc, error_messages|
|
44
44
|
if error_messages.is_a?(Array)
|
45
|
-
error_messages.each { |error_message| acc = "#{acc}#{error_message}\n" }
|
45
|
+
error_messages.each { |error_message| acc = "#{acc}#{prepare_error_message(error_message)}\n" }
|
46
46
|
else
|
47
|
-
acc = "#{acc}#{
|
47
|
+
acc = "#{acc}#{prepare_error_message(error_message)}\n"
|
48
48
|
end
|
49
49
|
|
50
50
|
acc
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
def prepare_error_message(error_message)
|
55
|
+
error_message.split('::').last
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end
|
@@ -20,7 +20,7 @@ class PreviewService
|
|
20
20
|
deployment_id = deployment[:id]
|
21
21
|
params = { id: deployment_id }
|
22
22
|
|
23
|
-
response = deploy_containers(
|
23
|
+
response = deploy_containers(server_url, project_slug, deployment_id, params)
|
24
24
|
|
25
25
|
if !Uffizzi::ResponseHelper.no_content?(response)
|
26
26
|
Uffizzi::ResponseHelper.handle_failed_response(response)
|
@@ -32,13 +32,17 @@ class PreviewService
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
+
def server_url
|
36
|
+
@server_url ||= Uffizzi::ConfigFile.read_option(:server)
|
37
|
+
end
|
38
|
+
|
35
39
|
def wait_containers_creation(deployment, project_slug)
|
36
40
|
spinner = TTY::Spinner.new('[:spinner] Creating containers...', format: :dots)
|
37
41
|
spinner.auto_spin
|
38
42
|
|
39
43
|
activity_items = []
|
40
44
|
loop do
|
41
|
-
response = get_activity_items(
|
45
|
+
response = get_activity_items(server_url, project_slug, deployment[:id])
|
42
46
|
handle_activity_items_response(response, spinner)
|
43
47
|
activity_items = response[:body][:activity_items]
|
44
48
|
break if activity_items.count == deployment[:containers].count
|
@@ -62,7 +66,7 @@ class PreviewService
|
|
62
66
|
containers_spinners = create_containers_spinners(activity_items, spinner)
|
63
67
|
|
64
68
|
loop do
|
65
|
-
response = get_activity_items(
|
69
|
+
response = get_activity_items(server_url, project_slug, deployment[:id])
|
66
70
|
handle_activity_items_response(response, spinner)
|
67
71
|
activity_items = response[:body][:activity_items]
|
68
72
|
update_containers_spinners!(activity_items, containers_spinners)
|
data/lib/uffizzi/version.rb
CHANGED
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: 0.11.
|
4
|
+
version: 0.11.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-06-
|
12
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: awesome_print
|