class SshConfigurator
Public Class Methods
link_current_key(name)
click to toggle source
# File lib/ssh_configurator.rb, line 4 def self.link_current_key(name) verify_ssh_config_exists FileUtils.ln_sf( File.expand_path("~/.ssh/#{name}"), File.expand_path('~/.ssh/current_key') ) end
Private Class Methods
error_message()
click to toggle source
# File lib/ssh_configurator.rb, line 25 def self.error_message "Creating ~/.ssh/config for you.\n" \ "Please edit it before you continue.\n" \ "Pairest will manage a symbolic link called\n" \ "current_key in ~/.ssh, so you probably want to\n" \ "keep that part of the ssh config the same.\n" end
skeleton_ssh_config()
click to toggle source
# File lib/ssh_configurator.rb, line 33 def self.skeleton_ssh_config "Host dev.example.com\n" \ " HostName dev.example.com\n" \ " User git\n" \ " IdentityFile ~/.ssh/current_key\n" end
verify_ssh_config_exists()
click to toggle source
# File lib/ssh_configurator.rb, line 15 def self.verify_ssh_config_exists full_config_path = File.expand_path('~/.ssh/config') unless File.exist? full_config_path File.write(full_config_path, skeleton_ssh_config) puts error_message raise SystemExit end end