kdeploy 1.0.6 → 1.0.7
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/exe/kdeploy +13 -0
- data/lib/kdeploy/cli.rb +15 -13
- 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: 15b3fbf88bffba0ba35c0b75e18cf57e5665d6bb512c354835574b07359de60a
|
4
|
+
data.tar.gz: 5e94c13abd994f4e2e445527aacd42dfd7a7e825f4a78c114b9c5aae78f928b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30e9abe01d5f729092df74cf6065279042421c42bde354c8214a497af56e6d0084f4618ef16ab9ec05d9f9adf9c8b8ab627d7fb22b59b407fdc904cf06917c79
|
7
|
+
data.tar.gz: 36827e5d4dd7178def48f0602d57ec5c1ee829a163082088915e1aad48f9a98feb00a7f04b6be80b6be802ec9d2ab3fed5b22bb1f3067db022e880f642bf50e9
|
data/exe/kdeploy
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
# 自动修复常见 gem 扩展
|
5
|
+
%w[debug rbs].zip(%w[1.7.1 2.8.2]).each do |gem_name, version|
|
6
|
+
require gem_name
|
7
|
+
rescue LoadError
|
8
|
+
warn "[Kdeploy] 自动修复 #{gem_name}-#{version} ..."
|
9
|
+
system("gem pristine #{gem_name} --version #{version}")
|
10
|
+
begin
|
11
|
+
require gem_name
|
12
|
+
rescue LoadError
|
13
|
+
warn "[Kdeploy] 依然无法加载 #{gem_name}-#{version},请手动修复。"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
4
17
|
require 'kdeploy'
|
5
18
|
|
6
19
|
Kdeploy::CLI.start(ARGV)
|
data/lib/kdeploy/cli.rb
CHANGED
@@ -79,6 +79,13 @@ module Kdeploy
|
|
79
79
|
method_option :parallel, type: :numeric, default: 5, desc: 'Number of parallel executions'
|
80
80
|
method_option :dry_run, type: :boolean, desc: 'Show what would be done'
|
81
81
|
def execute(task_file, task_name = nil)
|
82
|
+
# 只在最前面输出一次 banner
|
83
|
+
@banner_printed ||= false
|
84
|
+
unless @banner_printed
|
85
|
+
puts Kdeploy::Banner.show
|
86
|
+
@banner_printed = true
|
87
|
+
end
|
88
|
+
|
82
89
|
load_task_file(task_file)
|
83
90
|
|
84
91
|
tasks_to_run = if task_name
|
@@ -169,31 +176,26 @@ module Kdeploy
|
|
169
176
|
end
|
170
177
|
|
171
178
|
def print_results(results, task_name)
|
172
|
-
puts Kdeploy::Banner.show
|
173
179
|
pastel = Pastel.new
|
174
|
-
|
175
|
-
puts "#{pastel.bright_cyan('Task:')} #{pastel.bright_white(task_name)}"
|
176
|
-
puts
|
180
|
+
puts pastel.bright_cyan("\n=== Task: #{task_name} ===\n")
|
177
181
|
|
178
182
|
results.each do |host, result|
|
179
183
|
status = result[:status] == :success ? pastel.green('✓ Success') : pastel.red('✗ Failed')
|
180
|
-
puts
|
184
|
+
puts pastel.bright_white("[#{host}] #{status}")
|
181
185
|
|
182
186
|
if result[:status] == :success
|
183
187
|
result[:output].each do |cmd|
|
184
188
|
# 显示命令
|
185
189
|
if cmd[:command].include?('<<') || cmd[:command].include?("\n")
|
186
|
-
# 多行命令显示
|
187
190
|
first_line = cmd[:command].lines.first.strip
|
188
|
-
puts
|
191
|
+
puts pastel.bright_yellow(" $ #{first_line}")
|
189
192
|
cmd[:command].lines[1..].each do |line|
|
190
193
|
next if line.strip.empty?
|
191
194
|
|
192
|
-
puts
|
195
|
+
puts pastel.bright_yellow(" > #{line.strip}")
|
193
196
|
end
|
194
197
|
else
|
195
|
-
#
|
196
|
-
puts " #{pastel.bright_yellow('$')} #{cmd[:command].strip}"
|
198
|
+
puts pastel.bright_yellow(" $ #{cmd[:command].strip}")
|
197
199
|
end
|
198
200
|
|
199
201
|
# 显示输出
|
@@ -201,20 +203,20 @@ module Kdeploy
|
|
201
203
|
output.each_line do |line|
|
202
204
|
next if line.strip.empty?
|
203
205
|
|
204
|
-
puts "
|
206
|
+
puts pastel.white(" #{line.rstrip}")
|
205
207
|
end
|
206
208
|
|
207
209
|
# 显示错误输出
|
208
210
|
if cmd[:output].is_a?(Hash) && !cmd[:output][:stderr].empty?
|
209
211
|
cmd[:output][:stderr].each_line do |line|
|
210
|
-
puts
|
212
|
+
puts pastel.red(" #{line.rstrip}") unless line.strip.empty?
|
211
213
|
end
|
212
214
|
end
|
213
215
|
|
214
216
|
puts
|
215
217
|
end
|
216
218
|
else
|
217
|
-
puts
|
219
|
+
puts pastel.red(" #{result[:error]}")
|
218
220
|
puts
|
219
221
|
end
|
220
222
|
end
|
data/lib/kdeploy/version.rb
CHANGED