ssh-copy-id.rb 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ssh-copy-id.rb +14 -6
- data/lib/ssh-copy-id/version.rb +1 -1
- metadata +3 -4
data/lib/ssh-copy-id.rb
CHANGED
@@ -43,7 +43,7 @@ module SSHCopyID
|
|
43
43
|
def self.execute options, ask_password
|
44
44
|
identity_file = options[:identity] || DEFAULT_IDENTITY_FILE
|
45
45
|
identity = File.readlines(File.expand_path identity_file).first.chomp
|
46
|
-
|
46
|
+
passwords = {}
|
47
47
|
output = options[:output] || Class.new { def method_missing *args; end }.new
|
48
48
|
|
49
49
|
options[:hosts].each do |host|
|
@@ -51,13 +51,21 @@ module SSHCopyID
|
|
51
51
|
user, pass = user.split(':') if user
|
52
52
|
user ||= options[:username] || ENV['USER']
|
53
53
|
output.print "#{user}@#{host}: "
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
password =
|
55
|
+
if pass
|
56
|
+
pass
|
57
|
+
elsif options[:password]
|
58
|
+
options[:password]
|
59
|
+
elsif passwords[user]
|
60
|
+
passwords[user]
|
61
|
+
elsif ask_password || options.has_key?(:password)
|
62
|
+
passwords[user] = HighLine.new.ask($/ + "Password: ") { |q| q.echo = '*' }
|
63
|
+
else
|
64
|
+
nil
|
65
|
+
end
|
58
66
|
|
59
67
|
host, port = host.split(':')
|
60
|
-
Net::SSH.start(host, user, :port => port, :password =>
|
68
|
+
Net::SSH.start(host, user, :port => port, :password => password) do |ssh|
|
61
69
|
result = ssh.exec!(yield identity)
|
62
70
|
output.puts result
|
63
71
|
end
|
data/lib/ssh-copy-id/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ssh-copy-id.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
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-
|
12
|
+
date: 2013-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
@@ -83,10 +83,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
85
|
rubyforge_project:
|
86
|
-
rubygems_version: 1.8.
|
86
|
+
rubygems_version: 1.8.25
|
87
87
|
signing_key:
|
88
88
|
specification_version: 3
|
89
89
|
summary: ssh-copy-id in Ruby. Supports copying to multiple servers.
|
90
90
|
test_files:
|
91
91
|
- test/bin_helper.rb
|
92
|
-
has_rdoc:
|