Module: Devkit::SshIdentity
- Defined in:
- lib/devkit/ssh_identity.rb
Class Method Summary collapse
Class Method Details
.check(identity) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/devkit/ssh_identity.rb', line 19 def check(identity) ssh_identity = File.join("~/.ssh/", identity['SSH Identity']) ssh_identities = %x[ssh-add -l].split("\n") print "Checking identity, ".blue $stdout.flush if ssh_identities.length > 1 puts "Possible amibiguity. Please double check your identity".red else puts "Using ssh identity #{File.expand_path(ssh_identity)}".green end end |
.choose(identity) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/devkit/ssh_identity.rb', line 4 def choose(identity) ssh_identity = File.join("~/.ssh/", identity['SSH Identity']) print "Switching ssh identity to #{File.expand_path(ssh_identity)}, " $stdout.flush if File.exists?(File.(ssh_identity)) system("ssh-add -D") system("ssh-add #{ssh_identity}") else puts "#{identity["Full Name"]}'s ssh keys not found. Skipping identity switch.".red end check(identity) end |
.drop ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/devkit/ssh_identity.rb', line 39 def drop system("ssh-add -D") ssh_identities = %x[ssh-add -l].split("\n") if ssh_identities.length > 1 puts "Problem releasing existing identities. Possible amibiguity.".red else puts "Successfully dropped all the identities".green end end |
.status ⇒ Object
34 35 36 37 |
# File 'lib/devkit/ssh_identity.rb', line 34 def status ssh_identities = %x[ssh-add -l].split("\n") puts ssh_identities end |