ztk 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ztk/spinner.rb CHANGED
@@ -42,10 +42,9 @@ module ZTK
42
42
  spinner = Thread.new do
43
43
  while count do
44
44
  stdout.print(charset[(count += 1) % charset.length])
45
- stdout.respond_to?(:flush) and stdout.flush
46
- sleep(0.25)
47
45
  stdout.print("\b")
48
46
  stdout.respond_to?(:flush) and stdout.flush
47
+ sleep(0.25)
49
48
  end
50
49
  end
51
50
  yield.tap do
data/lib/ztk/ssh.rb CHANGED
@@ -169,8 +169,8 @@ module ZTK
169
169
  # end
170
170
  # puts ssh.exec("hostname -f").inspect
171
171
  def exec(command, options={})
172
- log(:info) { "exec(#{command.inspect}, #{options.inspect})" }
173
172
  log(:debug) { "config(#{@config.inspect})" }
173
+ log(:info) { "exec(#{command.inspect}, #{options.inspect})" }
174
174
 
175
175
  options = OpenStruct.new({ :silence => false }.merge(options))
176
176
  log(:debug) { "options(#{options.inspect})" }
@@ -217,8 +217,8 @@ module ZTK
217
217
  # remote = File.expand_path(File.join("/tmp", "id_rsa.pub"))
218
218
  # ssh.upload(local, remote)
219
219
  def upload(local, remote)
220
- log(:info) { "upload(#{local.inspect}, #{remote.inspect})" }
221
220
  log(:debug) { "config(#{@config.inspect})" }
221
+ log(:info) { "upload(#{local.inspect}, #{remote.inspect})" }
222
222
 
223
223
  sftp.upload!(local.to_s, remote.to_s) do |event, uploader, *args|
224
224
  case event
@@ -254,8 +254,8 @@ module ZTK
254
254
  # remote = File.expand_path(File.join(ENV["HOME"], ".ssh", "id_rsa.pub"))
255
255
  # ssh.download(remote, local)
256
256
  def download(remote, local)
257
- log(:info) { "download(#{remote.inspect}, #{local.inspect})" }
258
257
  log(:debug) { "config(#{@config.inspect})" }
258
+ log(:info) { "download(#{remote.inspect}, #{local.inspect})" }
259
259
 
260
260
  sftp.download!(remote.to_s, local.to_s) do |event, downloader, *args|
261
261
  case event
@@ -281,7 +281,6 @@ module ZTK
281
281
  # Builds our SSH console command.
282
282
  def console_command
283
283
  log(:debug) { "console_command" }
284
- log(:debug) { "config(#{@config.inspect})" }
285
284
 
286
285
  command = [ "ssh" ]
287
286
  command << [ "-q" ]
@@ -302,7 +301,6 @@ module ZTK
302
301
  # Builds our SSH proxy command.
303
302
  def proxy_command
304
303
  log(:debug) { "proxy_command" }
305
- log(:debug) { "config(#{@config.inspect})" }
306
304
 
307
305
  if !@config.proxy_user
308
306
  message = "You must specify an proxy user in order to SSH proxy."
@@ -335,7 +333,6 @@ module ZTK
335
333
  # Builds our SSH options hash.
336
334
  def ssh_options
337
335
  log(:debug) { "ssh_options" }
338
- log(:debug) { "config(#{@config.inspect})" }
339
336
 
340
337
  options = {}
341
338
 
@@ -126,7 +126,7 @@ module ZTK
126
126
  ((IO.select(nil, [socket], nil, @config.timeout) && socket.write(@config.data)) ? true : false)
127
127
  end
128
128
 
129
- rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EHOSTUNREACH => e
129
+ rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH => e
130
130
  log(:debug) { "#{@config.host}:#{@config.port} - #{e.message}" }
131
131
  false
132
132
  ensure
data/lib/ztk/version.rb CHANGED
@@ -19,5 +19,5 @@
19
19
  ################################################################################
20
20
 
21
21
  module ZTK
22
- VERSION = "0.0.16" unless const_defined?(:VERSION)
22
+ VERSION = "0.0.17" unless const_defined?(:VERSION)
23
23
  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: 0.0.16
4
+ version: 0.0.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-22 00:00:00.000000000 Z
12
+ date: 2013-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erubis