kdeploy 1.0.4 → 1.0.6
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 +2 -1
- data/lib/kdeploy/executor.rb +14 -7
- data/lib/kdeploy/runner.rb +4 -0
- 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: 0acb567d3c34e2937de6f0f4c455928ab071d9b0951499ba34c3dd10fc39b6dc
|
4
|
+
data.tar.gz: 96d62a683a09abcbce1b309294ccf8584ddb275fa4ed68f5ca09bb7efa1ee611
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdbc032e54d7915bc5d56d271ca54244d555f7d5b6200ee4b76dd9a6c6f060c5bc50408cd7e870cf2978f95901efd1ecd4805a2de3488df4fad95c6310b2bfdd
|
7
|
+
data.tar.gz: d629aaa50931b626de2fd11e8d4c4286f984dbff82a8f8e0fb8146ded23b5fbbb30536e031ec859a6558bcd75176198f55cb98a098c70b327bf3b9dd6b2d5cad
|
data/lib/kdeploy/cli.rb
CHANGED
data/lib/kdeploy/executor.rb
CHANGED
@@ -19,15 +19,22 @@ module Kdeploy
|
|
19
19
|
stdout = String.new
|
20
20
|
stderr = String.new
|
21
21
|
|
22
|
-
ssh.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
ssh.open_channel do |channel|
|
23
|
+
channel.exec(command) do |_ch, success|
|
24
|
+
raise "Could not execute command: #{command}" unless success
|
25
|
+
|
26
|
+
channel.on_data do |_ch, data|
|
27
|
+
print data # 实时输出
|
28
|
+
stdout << data
|
29
|
+
end
|
30
|
+
|
31
|
+
channel.on_extended_data do |_ch, _type, data|
|
32
|
+
print data # 实时输出
|
33
|
+
stderr << data
|
34
|
+
end
|
28
35
|
end
|
29
36
|
end
|
30
|
-
|
37
|
+
ssh.loop
|
31
38
|
{
|
32
39
|
stdout: stdout.strip,
|
33
40
|
stderr: stderr.strip,
|
data/lib/kdeploy/runner.rb
CHANGED
@@ -24,12 +24,16 @@ 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
29
|
output = executor.execute(command[:command])
|
28
30
|
result[:output] << { command: command[:command], output: output }
|
29
31
|
when :upload
|
32
|
+
puts "[#{name}] upload: #{command[:source]} -> #{command[:destination]}"
|
30
33
|
executor.upload(command[:source], command[:destination])
|
31
34
|
result[:output] << { command: "upload: #{command[:source]} -> #{command[:destination]}" }
|
32
35
|
when :upload_template
|
36
|
+
puts "[#{name}] upload_template: #{command[:source]} -> #{command[:destination]}"
|
33
37
|
executor.upload_template(command[:source], command[:destination], command[:variables])
|
34
38
|
result[:output] << { command: "upload_template: #{command[:source]} -> #{command[:destination]}" }
|
35
39
|
end
|
data/lib/kdeploy/version.rb
CHANGED