kdeploy 1.1.3 → 1.1.5
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/kdeploy/cli.rb +40 -18
- data/lib/kdeploy/runner.rb +14 -4
- data/lib/kdeploy/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: 9583a9a5362b5bf116325f3e9f930ff19be72c76d82060869284921079f93b19
|
4
|
+
data.tar.gz: cbfa824d6defd7511a71d985073de549442a34ed4e165093e422543e33c1e321
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b20ac3a10b3de646fe5c23a96cebae09a0fb825fde88b3698a3a7beb2715abf7e05076ca2b4cc04715ee54935053cb23d1b392f8f726af79c15c244c7bed32a7
|
7
|
+
data.tar.gz: 446eb1df1186929fc9576e55b558c869b01cfa7466f53a09e65836a59b365b5e3cb88bf98616393efd9181d84bc08b45b7e8348f89fa07ee75d5b9a53f9af173
|
data/lib/kdeploy/cli.rb
CHANGED
@@ -189,24 +189,46 @@ module Kdeploy
|
|
189
189
|
|
190
190
|
if %i[success changed].include?(result[:status])
|
191
191
|
shown = {}
|
192
|
-
result[:output].
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
step[:
|
209
|
-
|
192
|
+
grouped = result[:output].group_by { |step| step[:type] || :run }
|
193
|
+
grouped.each do |type, steps|
|
194
|
+
case type
|
195
|
+
when :upload
|
196
|
+
puts pastel.green(' === Upload ===')
|
197
|
+
steps.each do |step|
|
198
|
+
key = [step[:command], type].hash
|
199
|
+
next if shown[key]
|
200
|
+
|
201
|
+
shown[key] = true
|
202
|
+
duration_str = step[:duration] ? pastel.dim(" [#{'%.2f' % step[:duration]}s]") : ''
|
203
|
+
puts pastel.green(" [upload] #{step[:command].sub('upload: ', '')}#{duration_str}")
|
204
|
+
end
|
205
|
+
when :upload_template
|
206
|
+
puts pastel.yellow(' === Template ===')
|
207
|
+
steps.each do |step|
|
208
|
+
key = [step[:command], type].hash
|
209
|
+
next if shown[key]
|
210
|
+
|
211
|
+
shown[key] = true
|
212
|
+
duration_str = step[:duration] ? pastel.dim(" [#{'%.2f' % step[:duration]}s]") : ''
|
213
|
+
puts pastel.yellow(" [template] #{step[:command].sub('upload_template: ', '')}#{duration_str}")
|
214
|
+
end
|
215
|
+
when :run
|
216
|
+
puts pastel.cyan(' === Run ===')
|
217
|
+
steps.each do |step|
|
218
|
+
key = [step[:command], type].hash
|
219
|
+
next if shown[key]
|
220
|
+
|
221
|
+
shown[key] = true
|
222
|
+
duration_str = step[:duration] ? pastel.dim(" [#{'%.2f' % step[:duration]}s]") : ''
|
223
|
+
puts pastel.cyan(" [run] #{step[:command].to_s.lines.first.strip}#{duration_str}")
|
224
|
+
if step[:output].is_a?(Hash) && step[:output][:stdout]
|
225
|
+
step[:output][:stdout].each_line do |line|
|
226
|
+
puts " #{line.rstrip}" unless line.strip.empty?
|
227
|
+
end
|
228
|
+
elsif step[:output].is_a?(String)
|
229
|
+
step[:output].each_line do |line|
|
230
|
+
puts " #{line.rstrip}" unless line.strip.empty?
|
231
|
+
end
|
210
232
|
end
|
211
233
|
end
|
212
234
|
end
|
data/lib/kdeploy/runner.rb
CHANGED
@@ -49,7 +49,10 @@ module Kdeploy
|
|
49
49
|
puts pastel.bright_white("\n#{name.ljust(24)} : ")
|
50
50
|
puts pastel.cyan(" [run] #{command[:command].lines.first.strip}")
|
51
51
|
command[:command].lines[1..].each { |line| puts " > #{line.strip}" unless line.strip.empty? }
|
52
|
+
t1 = Time.now
|
52
53
|
output = executor.execute(command[:command])
|
54
|
+
t2 = Time.now
|
55
|
+
duration = t2 - t1
|
53
56
|
# 统一输出命令结果
|
54
57
|
if output[:stdout] && !output[:stdout].empty?
|
55
58
|
output[:stdout].each_line { |line| puts " #{line.rstrip}" unless line.strip.empty? }
|
@@ -57,19 +60,26 @@ module Kdeploy
|
|
57
60
|
if output[:stderr] && !output[:stderr].empty?
|
58
61
|
output[:stderr].each_line { |line| puts pastel.green(" #{line.rstrip}") unless line.strip.empty? }
|
59
62
|
end
|
60
|
-
result[:output] << { command: command[:command], output: output }
|
63
|
+
result[:output] << { command: command[:command], output: output, duration: duration, type: :run }
|
61
64
|
when :upload
|
62
65
|
pastel = Pastel.new
|
63
66
|
puts pastel.bright_white("\n#{name.ljust(24)} : ")
|
64
67
|
puts pastel.green(" [upload] #{command[:source]} -> #{command[:destination]}")
|
68
|
+
t1 = Time.now
|
65
69
|
executor.upload(command[:source], command[:destination])
|
66
|
-
|
70
|
+
t2 = Time.now
|
71
|
+
duration = t2 - t1
|
72
|
+
result[:output] << { command: "upload: #{command[:source]} -> #{command[:destination]}", duration: duration, type: :upload }
|
67
73
|
when :upload_template
|
68
74
|
pastel = Pastel.new
|
69
75
|
puts pastel.bright_white("\n#{name.ljust(24)} : ")
|
70
76
|
puts pastel.yellow(" [template] #{command[:source]} -> #{command[:destination]}")
|
71
|
-
|
72
|
-
|
77
|
+
t1 = Time.now
|
78
|
+
executor.upload_template(command[:source], command[:destination], command[:vars])
|
79
|
+
t2 = Time.now
|
80
|
+
duration = t2 - t1
|
81
|
+
result[:output] << { command: "upload_template: #{command[:source]} -> #{command[:destination]}", duration: duration,
|
82
|
+
type: :upload_template }
|
73
83
|
end
|
74
84
|
end
|
75
85
|
end
|
data/lib/kdeploy/version.rb
CHANGED