Class: Sumodev::Commands::Ssh
- Inherits:
- 
      Thor::Group
      
        - Object
- Thor::Group
- Sumodev::Commands::Ssh
 
- Includes:
- Thor::Actions
- Defined in:
- lib/sumodev/commands/ssh.rb
Constant Summary collapse
- Servers =
- { :web1 => {:login => 'root', :host => 'web01.crsolutions.be'}, :web2 => {:login => 'root', :host => 'web02.crsolutions.be'}, :mysql => {:login => 'root', :host => 'mysql01.crsolutions.be'}, :mail => {:login => 'root', :host => 'mail.crsolutions.be'}, :mail2 => {:login => 'root', :host => 'mail02.crsolutions.be'}, :factr => {:login => 'factr', :host => 'app01.factr.be'}, :sumodev => {:login => 'sites', :host => 'dev.sumocoders.eu'} } 
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.help(shell) ⇒ Object
| 22 23 24 25 26 | # File 'lib/sumodev/commands/ssh.rb', line 22 def help(shell) super shell.say "Possible servers: #{Servers.keys.join(', ')}" end | 
Instance Method Details
#check_ssh_key ⇒ Object
| 29 30 31 32 33 34 35 36 | # File 'lib/sumodev/commands/ssh.rb', line 29 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 ⇒ Object
| 38 39 40 41 42 43 44 45 46 47 48 49 | # File 'lib/sumodev/commands/ssh.rb', line 38 def connect server_details = Servers[server.to_sym] if server_details login = .fetch(:login, server_details[:login]) host = server_details[:host] run "ssh #{login}@#{host}" else say "No such server definition" end end |