kdeploy 1.2.11 → 1.2.13

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: 00c88dd8eb1c063888857d27c84c2e115984f811f36871479f5819a1090a4dfe
4
- data.tar.gz: 5f99f88900231db8dddfacfd83863a7505bf6a7ed9cb919c80c7769c6329ca6b
3
+ metadata.gz: ee6777b5bafc0dabf9a3b77328921ab0336a950f39074c557d5b20ffd2eeb5d9
4
+ data.tar.gz: ac8b53ce8ac327b3e046d833a06200571bdad1e6a2e1a858f7943f1a933c9edc
5
5
  SHA512:
6
- metadata.gz: a4d6f11534940e7b1c7920edb0796dc9d105db989edcabf094d5f00de974c67576f4b75ccbbd4b3b667f77004360e8be7395958ac559e20a3e3c379b0864e954
7
- data.tar.gz: b6c1bded66d2c119641d1e15b167077f405ad8765c741702d4b654b80f4efd146d3f804cf4c436a994dd49b14959f5e04b9841aa3e765ee4344ff48a724da443
6
+ metadata.gz: d2f6220b559ec101c3edf247e91c4e040dc8342c101cfd547e67206761a4bb77510220505a3f83b352f987442686bbb6861adf91f2d251466e2be6d5bc391edd
7
+ data.tar.gz: f6b4f307065412c7a42f61acdf6ca69ebead8c895f59647d5fdcf6e7fd05c8d5da07b975052b549798dfd39f55218f3bd61725e9f8fd2a4a6ca94da7495518ae
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,18 @@ 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
+
15
19
  result, duration = measure_time do
16
20
  @executor.execute(cmd, use_sudo: use_sudo)
17
21
  end
22
+
23
+ # Show execution time if command took more than 1 second
24
+ @output.write_line(pastel.dim(" [completed in #{format('%.2f', duration)}s]")) if duration > 1.0
25
+
26
+ # Show command output
18
27
  show_command_output(result)
19
28
  { command: cmd, output: result, duration: duration, type: :run }
20
29
  end
@@ -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.concat(format_command_output(step[: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,53 @@ module Kdeploy
166
168
  result = []
167
169
  return result unless output
168
170
 
169
- if output.is_a?(Hash) && output[:stdout]
170
- format_stdout_lines(output[:stdout], result)
171
- elsif output.is_a?(String)
171
+ if output.is_a?(Hash)
172
+ format_hash_output(output, result)
173
+ elsif output.is_a?(String) && !output.strip.empty?
172
174
  format_stdout_lines(output, result)
173
175
  end
174
176
  result
175
177
  end
176
178
 
179
+ def format_hash_output(output, result)
180
+ format_stdout_from_hash(output, result)
181
+ format_stderr_from_hash(output, result)
182
+ end
183
+
184
+ def format_stdout_from_hash(output, result)
185
+ return unless output.key?(:stdout)
186
+
187
+ stdout = output[:stdout]
188
+ format_stdout_lines(stdout, result) if stdout && !stdout.to_s.strip.empty?
189
+ end
190
+
191
+ def format_stderr_from_hash(output, result)
192
+ return unless output.key?(:stderr)
193
+
194
+ stderr = output[:stderr]
195
+ format_stderr_lines(stderr, result) if stderr && !stderr.to_s.strip.empty?
196
+ end
197
+
177
198
  def format_stdout_lines(stdout, result)
178
- stdout.each_line do |line|
179
- result << @pastel.green(" #{line.rstrip}") unless line.strip.empty?
199
+ return result if stdout.nil? || stdout.to_s.empty?
200
+
201
+ stdout.to_s.each_line do |line|
202
+ stripped = line.rstrip
203
+ # Show all non-empty lines
204
+ result << @pastel.green(" #{stripped}") unless stripped.empty?
180
205
  end
206
+ result
207
+ end
208
+
209
+ def format_stderr_lines(stderr, result)
210
+ return result if stderr.nil? || stderr.to_s.empty?
211
+
212
+ stderr.to_s.each_line do |line|
213
+ stripped = line.rstrip
214
+ # Show all non-empty stderr lines in yellow
215
+ result << @pastel.yellow(" #{stripped}") unless stripped.empty?
216
+ end
217
+ result
181
218
  end
182
219
 
183
220
  def step_already_shown?(step, type, shown)
@@ -31,7 +31,22 @@ module Kdeploy
31
31
 
32
32
  def execute_concurrent_tasks(task)
33
33
  futures = create_task_futures(task)
34
- futures.each(&:wait)
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.each do |command|
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Kdeploy module for version management
4
4
  module Kdeploy
5
- VERSION = '1.2.11' unless const_defined?(:VERSION)
5
+ VERSION = '1.2.13' unless const_defined?(:VERSION)
6
6
  end
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.11
4
+ version: 1.2.13
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-18 00:00:00.000000000 Z
11
+ date: 2025-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby