class Sumodev::Commands::Ssh
Constants
- Servers
Public Class Methods
help(shell)
click to toggle source
Calls superclass method
# File lib/sumodev/commands/ssh.rb, line 21 def help(shell) super shell.say "Possible servers: #{Servers.keys.join(', ')}" end
Public Instance Methods
check_ssh_key()
click to toggle source
# File lib/sumodev/commands/ssh.rb, line 28 def check_ssh_key if Dir.glob(ENV["HOME"] + "/.ssh/id_[rd]sa").none? # No SSH key installed if yes?("No SSH key installed! Do you want me to generate one for you?") run "ssh-keygen -t rsa -f #{ENV["HOME"]}/.ssh/id_rsa" end end end
connect()
click to toggle source
# File lib/sumodev/commands/ssh.rb, line 37 def connect server_details = Servers[server.to_sym] if server_details login = options.fetch(:login, server_details[:login]) host = server_details[:host] run "ssh #{login}@#{host}" else say "No such server definition" end end