kdeploy 1.0.8 → 1.0.9

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: 71b80d4b4cf5194def86c21793e7a284f524288f06e215fd6d44f0fa408dfe18
4
- data.tar.gz: d8f28a18304adc12256633567c872d1368a29a644c9e4b1f2cdd44e5ba3d9413
3
+ metadata.gz: '079548e82a360553e00c1aecb5967fd7d57320dbf5d89684a992885444e0e5ac'
4
+ data.tar.gz: 4b639818b4116f7111fe44ef3d983abf8fdc0c24ac0ee558f35e09d9d3592722
5
5
  SHA512:
6
- metadata.gz: f2e3a70987d5390dc53c4c68091533dfb6f8e9e9b695f03aeaa5c5e1c48c7d646cac698ac5760bb30d5a32a7c1b0ee51ca720e2d9507253d87b2ac01ea0a19ce
7
- data.tar.gz: b6908b7720edda9e4ff81a2b5f2d679e5ffe7774d62d33de91dd191b5773590020ec49c43b45d58d520da6d7ef6193bca6120e6b7dd1d46b84344081081d80fa
6
+ metadata.gz: f07494332413308f446e39e91f75f856ee1b0484c662ac299d2c2300e01b5ece8d32e072cd727371b53d0542df48a1e8678d0de5889696b09903bda6438005a5
7
+ data.tar.gz: 91ecd8ede72319bf7693424fe6e2efcee9f9ddb7e82ce2db28ae52f69ed622ec57ba019c49c70d3a7aacbc5357b02d4b5c9861dc294fdd4b15e55540b324fa83
data/lib/kdeploy/cli.rb CHANGED
@@ -221,11 +221,15 @@ module Kdeploy
221
221
 
222
222
  # summary
223
223
  puts pastel.cyan("\nPLAY RECAP #{'*' * 64}")
224
+ max_host_len = results.keys.map(&:length).max || 16
224
225
  results.each do |host, result|
225
226
  ok = %i[success changed].include?(result[:status]) ? result[:output].size : 0
226
227
  failed = result[:status] == :failed ? 1 : 0
227
228
  changed = result[:status] == :changed ? result[:output].size : 0
228
- puts "#{host.ljust(24)} : ok=#{ok} changed=#{changed} failed=#{failed}"
229
+ ok_str = pastel.green("ok=#{ok.to_s.ljust(3)}")
230
+ changed_str = pastel.yellow("changed=#{changed.to_s.ljust(3)}")
231
+ failed_str = pastel.red("failed=#{failed.to_s.ljust(3)}")
232
+ puts "#{host.ljust(max_host_len)} : #{ok_str} #{changed_str} #{failed_str}"
229
233
  end
230
234
  end
231
235
  end
@@ -24,16 +24,23 @@ module Kdeploy
24
24
  task[:block].call.each do |command|
25
25
  case command[:type]
26
26
  when :run
27
- puts "[#{name}] $ #{command[:command].lines.first.strip}" # 实时输出主机和命令
28
- command[:command].lines[1..].each { |line| puts "[#{name}] > #{line.strip}" unless line.strip.empty? }
27
+ # 美化输出
28
+ pastel = Pastel.new
29
+ puts pastel.bright_white("\n#{name.ljust(24)} : ")
30
+ puts pastel.cyan(" [run] #{command[:command].lines.first.strip}")
31
+ command[:command].lines[1..].each { |line| puts " > #{line.strip}" unless line.strip.empty? }
29
32
  output = executor.execute(command[:command])
30
33
  result[:output] << { command: command[:command], output: output }
31
34
  when :upload
32
- puts "[#{name}] upload: #{command[:source]} -> #{command[:destination]}"
35
+ pastel = Pastel.new
36
+ puts pastel.bright_white("\n#{name.ljust(24)} : ")
37
+ puts pastel.green(" [upload] #{command[:source]} -> #{command[:destination]}")
33
38
  executor.upload(command[:source], command[:destination])
34
39
  result[:output] << { command: "upload: #{command[:source]} -> #{command[:destination]}" }
35
40
  when :upload_template
36
- puts "[#{name}] upload_template: #{command[:source]} -> #{command[:destination]}"
41
+ pastel = Pastel.new
42
+ puts pastel.bright_white("\n#{name.ljust(24)} : ")
43
+ puts pastel.yellow(" [template] #{command[:source]} -> #{command[:destination]}")
37
44
  executor.upload_template(command[:source], command[:destination], command[:variables])
38
45
  result[:output] << { command: "upload_template: #{command[:source]} -> #{command[:destination]}" }
39
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kdeploy
4
- VERSION = '1.0.8'
4
+ VERSION = '1.0.9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kdeploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kk