ztk 1.17.4 → 1.18.0

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2ZkMDdkYTc2ZjMyOTQ3ZTFhYThmZGRlNDhhMzMyNzVjZmExOWJiZg==
4
+ ZTdlMWFhZjVjYjllYjMzMjExOWZlNDI5ZjM1OWE1Mjk0Nzc3ZGEyMw==
5
5
  data.tar.gz: !binary |-
6
- N2Y2ZWY4YWMzMWQwYWU1NjRhNDk0N2YwMDg2NTVjZmViMjVmOTliZg==
6
+ ODg4YWYxMjhiMDg0OTgzZWNlOTcxMzRhOTM4YmYzZWJkNWYwZDU0Nw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTQyOWM2NDFmMDc1YjdlMmI1MTNjNDNiMWQzMWVhZWIxY2Q5MTBjNzBkNTBm
10
- OGNjYmQ0NTc5YzQxYmU5ZWRiY2Q5OGJmZDRiMDZhMzJkZTkzOWY0ZWIyY2Q5
11
- YWQzZTBlNGYwNjM5YzFlMDkyYzk5YzRkYmQ4MDZhMGMxMDEwZGU=
9
+ ZjYyN2YzNjJmYzQ4YzI3M2FlOTE3NWE1NjRhNDhjMjNkOTM2Njg4MDQzZDZk
10
+ YjhmZmMwZjFkMWNjODcyZjUzOTcxYzE0NDAwZDE4YWY5NTYzOWZkN2FjYzE5
11
+ ZWRhMGI2Y2I0OGE1NjE5YTZiYzM0ZmY4ZjY2OGE3Y2U5MzMzOTc=
12
12
  data.tar.gz: !binary |-
13
- NDQ2ODg5M2U3MzY4ZDY3MmJmZjVlMGUwNjFiNTNkMmMwYzJlOGJjOGU2MzE4
14
- ZDQxYTU4YzlkZmVjMTBjYWJlMDI2NmU5MDZlMmI0M2Q0YjZjYTAzNzliZDAz
15
- ZWRiODRiYjljNzJkZWJkNGM4ZjBjZTBiZWQ5Zjg5YTJjYzcwZDc=
13
+ MWViZWEwOWJiZTkzODIyOTYzOTIyMjE2MTYwYTg4ZTNjZGMzZGZjZWVjZjg5
14
+ Y2E1NDFiYWE1MGFmNmRiZjRjZjc2YzNjMTFmYzA1MmE5OGQ3NDQ2N2M4YzA3
15
+ NGRiMTE3MjIxNDljNmFkNTA5YWI2NGM1YWZlYzU4ZGFkNmQ1OWQ=
data/lib/ztk/ansi.rb CHANGED
@@ -175,6 +175,27 @@ module ZTK
175
175
  end
176
176
  end
177
177
 
178
+ def reset(string=nil, &block)
179
+ result = Array.new
180
+
181
+ result << %(\e[2J)
182
+ if block_given?
183
+ result << block.call
184
+ elsif string.respond_to?(:to_str)
185
+ result << string.to_str
186
+ elsif respond_to?(:to_str)
187
+ result << to_str
188
+ else
189
+ return result
190
+ end
191
+
192
+ result.join
193
+ end
194
+
195
+ def goto(x=0, y=0)
196
+ %(\e[#{x};#{y}H)
197
+ end
198
+
178
199
  extend self
179
200
 
180
201
  build_ansi_methods(ANSI_COLORS)
data/lib/ztk/parallel.rb CHANGED
@@ -146,7 +146,7 @@ module ZTK
146
146
 
147
147
  %w( kill term int hup ).map(&:upcase).each do |signal|
148
148
  Signal.trap(signal) do
149
- $stderr.puts("SIG#{signal} received by PID##{Process.pid}; aborting parallel executing...")
149
+ $stderr.puts("SIG#{signal} received by PID##{Process.pid}; signaling child processes...")
150
150
 
151
151
  signal_all(signal)
152
152
  exit!(1)
@@ -216,10 +216,10 @@ module ZTK
216
216
  # @return [Array<pid, status, data>] An array containing the pid,
217
217
  # status and data returned from the process block. If wait2() fails nil
218
218
  # is returned.
219
- def wait
219
+ def wait(flags=0)
220
220
  config.ui.logger.debug { "wait" }
221
221
  config.ui.logger.debug { "forks(#{@forks.inspect})" }
222
- pid, status = (Process.wait2(-1) rescue nil)
222
+ pid, status = (Process.wait2(-1, flags) rescue nil)
223
223
 
224
224
  if !pid.nil? && !status.nil? && !(fork = @forks.select{ |f| f[:pid] == pid }.first).nil?
225
225
  data = (Marshal.load(Base64.decode64(fork[:reader].read.to_s)) rescue nil)
data/lib/ztk/ssh/core.rb CHANGED
@@ -67,8 +67,8 @@ module ZTK
67
67
 
68
68
  # Attempts to close the gateway session if it is valid.
69
69
  def close_gateway
70
- if (!@gateway.nil? && !@gateway.closed?)
71
- config.ui.logger.debug { "gateway object is valid and not shutdown" }
70
+ if (!@gateway.nil?)
71
+ config.ui.logger.debug { "gateway object is valid" }
72
72
 
73
73
  begin
74
74
  config.ui.logger.debug { "attempting to shutdown" }
data/lib/ztk/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module ZTK
2
2
 
3
3
  # ZTK Version String
4
- VERSION = "1.17.4"
4
+ VERSION = "1.18.0"
5
5
 
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ztk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.4
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Patten