kdeploy 1.2.10 → 1.2.12
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 +6 -0
- data/lib/kdeploy/command_executor.rb +10 -0
- data/lib/kdeploy/output.rb +7 -0
- data/lib/kdeploy/output_formatter.rb +34 -6
- data/lib/kdeploy/runner.rb +23 -2
- data/lib/kdeploy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7619f068ed4e5681529a7f1a06574d116e7e1552f0f36742f44e4994610bde51
|
|
4
|
+
data.tar.gz: c388f8b7cd2e3833757f440ff535ec40d9baa7c5c3037bda7e2c418f288d0528
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8dc29c50ce326bfd7fb2e41e983432a8219140e23256f2521ce29d20f8ae28681193dc31ce2f04ddb3c93881434a9c43ff0f20439dae200800989527a26cbcb
|
|
7
|
+
data.tar.gz: 9d442d78aeacaa8c3577a98b66dd493790abbe88c6ca400b637ff3a938f25fdc47b50c736296d3d82026ac76045602ad76d70a8804d7d051d369f2703e6a8b01
|
data/lib/kdeploy/cli.rb
CHANGED
|
@@ -117,6 +117,12 @@ module Kdeploy
|
|
|
117
117
|
formatter = OutputFormatter.new
|
|
118
118
|
puts formatter.format_task_header(task_name)
|
|
119
119
|
|
|
120
|
+
if results.empty?
|
|
121
|
+
puts Kdeploy::Banner.show_error("No hosts executed for task: #{task_name}")
|
|
122
|
+
puts 'This usually means no hosts matched the task configuration.'
|
|
123
|
+
return
|
|
124
|
+
end
|
|
125
|
+
|
|
120
126
|
results.each do |host, result|
|
|
121
127
|
puts formatter.format_host_status(host, result[:status])
|
|
122
128
|
print_host_result(host, result, formatter)
|
|
@@ -12,9 +12,19 @@ module Kdeploy
|
|
|
12
12
|
cmd = command[:command]
|
|
13
13
|
use_sudo = command[:sudo]
|
|
14
14
|
show_command_header(host_name, :run, cmd)
|
|
15
|
+
|
|
16
|
+
# Show progress indicator for long-running commands
|
|
17
|
+
pastel = @output.respond_to?(:pastel) ? @output.pastel : Pastel.new
|
|
18
|
+
Time.now
|
|
19
|
+
|
|
15
20
|
result, duration = measure_time do
|
|
16
21
|
@executor.execute(cmd, use_sudo: use_sudo)
|
|
17
22
|
end
|
|
23
|
+
|
|
24
|
+
# Show execution time if command took more than 1 second
|
|
25
|
+
@output.write_line(pastel.dim(" [completed in #{format('%.2f', duration)}s]")) if duration > 1.0
|
|
26
|
+
|
|
27
|
+
# Show command output
|
|
18
28
|
show_command_output(result)
|
|
19
29
|
{ command: cmd, output: result, duration: duration, type: :run }
|
|
20
30
|
end
|
data/lib/kdeploy/output.rb
CHANGED
|
@@ -27,14 +27,21 @@ module Kdeploy
|
|
|
27
27
|
|
|
28
28
|
def write(message)
|
|
29
29
|
print(message)
|
|
30
|
+
$stdout.flush # Ensure immediate output
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
def write_line(message)
|
|
33
34
|
puts(message)
|
|
35
|
+
$stdout.flush # Ensure immediate output
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
def write_error(message)
|
|
37
39
|
puts(@pastel.red(message))
|
|
40
|
+
$stdout.flush # Ensure immediate output
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def flush
|
|
44
|
+
$stdout.flush
|
|
38
45
|
end
|
|
39
46
|
|
|
40
47
|
attr_reader :pastel
|
|
@@ -66,7 +66,9 @@ module Kdeploy
|
|
|
66
66
|
command_line = step[:command].to_s.lines.first.strip
|
|
67
67
|
output << @pastel.cyan(" [run] #{command_line}#{duration_str}")
|
|
68
68
|
output.concat(format_multiline_command(step[:command]))
|
|
69
|
-
output
|
|
69
|
+
# Format and add command output (stdout/stderr)
|
|
70
|
+
cmd_output = format_command_output(step[:output])
|
|
71
|
+
output.concat(cmd_output) if cmd_output.any?
|
|
70
72
|
output
|
|
71
73
|
end
|
|
72
74
|
|
|
@@ -166,18 +168,44 @@ module Kdeploy
|
|
|
166
168
|
result = []
|
|
167
169
|
return result unless output
|
|
168
170
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
# Handle Hash with stdout/stderr keys
|
|
172
|
+
if output.is_a?(Hash)
|
|
173
|
+
# Check for stdout key
|
|
174
|
+
if output.key?(:stdout)
|
|
175
|
+
stdout = output[:stdout]
|
|
176
|
+
format_stdout_lines(stdout, result) if stdout && !stdout.to_s.strip.empty?
|
|
177
|
+
end
|
|
178
|
+
# Check for stderr key
|
|
179
|
+
if output.key?(:stderr)
|
|
180
|
+
stderr = output[:stderr]
|
|
181
|
+
format_stderr_lines(stderr, result) if stderr && !stderr.to_s.strip.empty?
|
|
182
|
+
end
|
|
183
|
+
elsif output.is_a?(String) && !output.strip.empty?
|
|
172
184
|
format_stdout_lines(output, result)
|
|
173
185
|
end
|
|
174
186
|
result
|
|
175
187
|
end
|
|
176
188
|
|
|
177
189
|
def format_stdout_lines(stdout, result)
|
|
178
|
-
stdout.
|
|
179
|
-
|
|
190
|
+
return result if stdout.nil? || stdout.to_s.empty?
|
|
191
|
+
|
|
192
|
+
stdout.to_s.each_line do |line|
|
|
193
|
+
stripped = line.rstrip
|
|
194
|
+
# Show all non-empty lines
|
|
195
|
+
result << @pastel.green(" #{stripped}") unless stripped.empty?
|
|
180
196
|
end
|
|
197
|
+
result
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def format_stderr_lines(stderr, result)
|
|
201
|
+
return result if stderr.nil? || stderr.to_s.empty?
|
|
202
|
+
|
|
203
|
+
stderr.to_s.each_line do |line|
|
|
204
|
+
stripped = line.rstrip
|
|
205
|
+
# Show all non-empty stderr lines in yellow
|
|
206
|
+
result << @pastel.yellow(" #{stripped}") unless stripped.empty?
|
|
207
|
+
end
|
|
208
|
+
result
|
|
181
209
|
end
|
|
182
210
|
|
|
183
211
|
def step_already_shown?(step, type, shown)
|
data/lib/kdeploy/runner.rb
CHANGED
|
@@ -31,7 +31,22 @@ module Kdeploy
|
|
|
31
31
|
|
|
32
32
|
def execute_concurrent_tasks(task)
|
|
33
33
|
futures = create_task_futures(task)
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
# Show progress while waiting for tasks to complete
|
|
36
|
+
total = futures.length
|
|
37
|
+
completed = 0
|
|
38
|
+
|
|
39
|
+
futures.each do |future|
|
|
40
|
+
future.wait
|
|
41
|
+
completed += 1
|
|
42
|
+
# Show progress for multiple hosts
|
|
43
|
+
next unless total > 1
|
|
44
|
+
|
|
45
|
+
pastel = @output.respond_to?(:pastel) ? @output.pastel : Pastel.new
|
|
46
|
+
@output.write_line(pastel.dim(" [Progress: #{completed}/#{total} hosts completed]"))
|
|
47
|
+
@output.flush if @output.respond_to?(:flush)
|
|
48
|
+
end
|
|
49
|
+
|
|
35
50
|
@results
|
|
36
51
|
end
|
|
37
52
|
|
|
@@ -70,7 +85,13 @@ module Kdeploy
|
|
|
70
85
|
task_desc = CommandGrouper.task_description(first_cmd)
|
|
71
86
|
show_task_header(task_desc)
|
|
72
87
|
|
|
73
|
-
command_group.
|
|
88
|
+
command_group.each_with_index do |command, index|
|
|
89
|
+
# Show progress for multiple commands
|
|
90
|
+
if command_group.length > 1
|
|
91
|
+
pastel = @output.respond_to?(:pastel) ? @output.pastel : Pastel.new
|
|
92
|
+
@output.write_line(pastel.dim(" [Step #{index + 1}/#{command_group.length}]"))
|
|
93
|
+
end
|
|
94
|
+
|
|
74
95
|
step_result = execute_command(command_executor, command, name)
|
|
75
96
|
result[:output] << step_result
|
|
76
97
|
end
|
data/lib/kdeploy/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kdeploy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kk
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|