hotdog 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hotdog/commands/ssh.rb +21 -5
- data/lib/hotdog/version.rb +1 -1
- 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: be590bcf10423710cc9b86db34d0aaec800d9eaf
|
4
|
+
data.tar.gz: fb1eaa5dd9f40e4ff4889f378e1093a647e0cb90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75e2e9648fb2229292f79d70c4609ea7340637891b2a5c5db3cc637cf9e9a420f27dd2c940996cfd4ae2c22b638c2fbedf628a526e55efad474068e7ad34b5ff
|
7
|
+
data.tar.gz: 055408cd88e6f4bc745dd6ed56008107bad40a3bc7db6e8bab7698c0b2278a3b6ebb52b19546871ae05c1f2169fc8f6b72ccd5357d89cd37c6383e463b760322
|
data/lib/hotdog/commands/ssh.rb
CHANGED
@@ -13,7 +13,9 @@ module Hotdog
|
|
13
13
|
index: nil,
|
14
14
|
options: [],
|
15
15
|
user: nil,
|
16
|
+
port: nil,
|
16
17
|
identity_file: nil,
|
18
|
+
forward_agent: false,
|
17
19
|
}
|
18
20
|
|
19
21
|
optparse.on("-n", "--index INDEX", "Use this index of host if multiple servers are found", Integer) do |index|
|
@@ -25,12 +27,19 @@ module Hotdog
|
|
25
27
|
optparse.on("-i SSH_IDENTITY_FILE", "SSH identity file path") do |path|
|
26
28
|
ssh_option[:identity_file] = path
|
27
29
|
end
|
30
|
+
optparse.on("-A", "Enable agent forwarding", TrueClass) do |b|
|
31
|
+
ssh_option[:forward_agent] = b
|
32
|
+
end
|
33
|
+
optparse.on("-p PORT", "Port of the remote host", Integer) do |port|
|
34
|
+
ssh_option[:port] = port
|
35
|
+
end
|
28
36
|
optparse.on("-u SSH_USER", "SSH login user name") do |user|
|
29
37
|
ssh_option[:user] = user
|
30
38
|
end
|
31
39
|
|
32
|
-
|
33
|
-
|
40
|
+
search_args = []
|
41
|
+
optparse.order!(args) {|search_arg| search_args.push(search_arg) }
|
42
|
+
expression = search_args.join(" ").strip
|
34
43
|
if expression.empty?
|
35
44
|
exit(1)
|
36
45
|
end
|
@@ -47,7 +56,7 @@ module Hotdog
|
|
47
56
|
if result.length == 1
|
48
57
|
host = result[0]
|
49
58
|
elsif result.empty?
|
50
|
-
STDERR.puts("no match found: #{
|
59
|
+
STDERR.puts("no match found: #{search_args.join(" ")}")
|
51
60
|
exit(1)
|
52
61
|
else
|
53
62
|
if ssh_option[:index] && result.length > ssh_option[:index]
|
@@ -76,13 +85,20 @@ module Hotdog
|
|
76
85
|
if path = ssh_option[:identity_file]
|
77
86
|
cmdline << "-i" << Shellwords.escape(path)
|
78
87
|
end
|
88
|
+
if port = ssh_option[:port]
|
89
|
+
cmdline << "-p" << port.to_s
|
90
|
+
end
|
91
|
+
if ssh_option[:forward_agent]
|
92
|
+
cmdline << "-A"
|
93
|
+
end
|
79
94
|
if user = ssh_option[:user]
|
80
|
-
cmdline << (
|
95
|
+
cmdline << (user + "@" + address)
|
81
96
|
else
|
82
97
|
cmdline << address
|
83
98
|
end
|
99
|
+
cmdline.concat(args)
|
84
100
|
|
85
|
-
exec cmdline
|
101
|
+
exec *cmdline
|
86
102
|
exit(127)
|
87
103
|
end
|
88
104
|
end
|
data/lib/hotdog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hotdog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yamashita Yuu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|