rosh 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rosh/version.rb +1 -1
  3. data/lib/rosh.rb +4 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80f3a67a783c808654e6ddc08867858e5f0f8970
4
- data.tar.gz: 23940c39a4503f78ab123dc4ef0b6a7c66c2828f
3
+ metadata.gz: 63051cbc3ebc6dff450adf0b743bdbc84b8d7175
4
+ data.tar.gz: bf806793eac433c0c9fed367d1d774a155884979
5
5
  SHA512:
6
- metadata.gz: 3337e1ce903648d26dfb737606701e6c50502a53a30a6e51d5f932ec2d7f946851d5e6a60224bdda0b37606cbd27d2a6e48f0e270e242c96228c599f952697c8
7
- data.tar.gz: 560ea450e9b8da30f3e4e29eef1c8bc2238ebd78cc515e9c04a0f1b8e087e6a788ce7ee9f8c30e28c52d9267736cdf8f3b3482b8504513f6fbcd678568d8e9e6
6
+ metadata.gz: 4c988c653261d9929b5c2c7456988c47d84f2fd7f4185f48845b028652ac28f4ca7602a5d3a96e0e23e1d021006fab56876d944cc3b86a93a6832dcd5bf5761a
7
+ data.tar.gz: c01022ea292846e22cdb2b1b3323c1114a0bc0ea6cb8377274afe9499c92158219d715b7a0e85037cc779d0520f06927d140b24df26e815dbb22eb2e6a5dc07c
data/lib/rosh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Rosh
2
- VERSION = '0.3.1'
2
+ VERSION = '0.4.0'
3
3
  end
data/lib/rosh.rb CHANGED
@@ -6,6 +6,7 @@ require File.join(File.dirname(__FILE__), %w[rosh version])
6
6
 
7
7
  class Rosh
8
8
  def initialize(*args)
9
+ @interval = 3
9
10
  @ssh_opts = []
10
11
  alive_interval = 5
11
12
  @escape = '^t'
@@ -13,6 +14,7 @@ class Rosh
13
14
  opt.banner = 'Usage: rosh [options] hostname [session-name]'
14
15
  opt.on('-a alive-interval'){|v| alive_interval = v.to_i}
15
16
  opt.on('-e escape'){|v| @escape = v}
17
+ opt.on('-I interval'){|v| @interval = v.to_f}
16
18
  end.parse! args
17
19
  @host, @name = *args, :default
18
20
  abort 'hostname is required' if @host == :default
@@ -43,7 +45,7 @@ class Rosh
43
45
  end
44
46
  @first_try = false
45
47
  else
46
- sleep [@last_try - Time.now + 1, 0].max if @last_try
48
+ sleep [@last_try - Time.now + @interval, 0].max if @last_try
47
49
  puts "reconnecting..."
48
50
  @last_try = Time.now
49
51
  end
@@ -54,7 +56,7 @@ private
54
56
 
55
57
  def resolv
56
58
  uri = URI("//#{@host}")
57
- uri.host = Resolv.getaddress uri.host
59
+ uri.host = Resolv::DNS.new.getaddress(uri.host).to_s
58
60
  uri.to_s[2..-1]
59
61
  rescue Exception
60
62
  @host
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rosh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Takiuchi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-24 00:00:00.000000000 Z
11
+ date: 2013-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler