rosh 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rosh/version.rb +1 -1
- data/lib/rosh.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63051cbc3ebc6dff450adf0b743bdbc84b8d7175
|
4
|
+
data.tar.gz: bf806793eac433c0c9fed367d1d774a155884979
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c988c653261d9929b5c2c7456988c47d84f2fd7f4185f48845b028652ac28f4ca7602a5d3a96e0e23e1d021006fab56876d944cc3b86a93a6832dcd5bf5761a
|
7
|
+
data.tar.gz: c01022ea292846e22cdb2b1b3323c1114a0bc0ea6cb8377274afe9499c92158219d715b7a0e85037cc779d0520f06927d140b24df26e815dbb22eb2e6a5dc07c
|
data/lib/rosh/version.rb
CHANGED
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 +
|
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
|
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.
|
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-
|
11
|
+
date: 2013-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|