Class: SshConfigurator
- Inherits:
-
Object
- Object
- SshConfigurator
- Defined in:
- lib/ssh_configurator.rb
Class Method Summary collapse
- .error_message ⇒ Object
- .link_current_key(name) ⇒ Object
- .skeleton_ssh_config ⇒ Object
- .verify_ssh_config_exists ⇒ Object
Class Method Details
.error_message ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/ssh_configurator.rb', line 25 def self. "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 |
.link_current_key(name) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/ssh_configurator.rb', line 4 def self.link_current_key(name) verify_ssh_config_exists FileUtils.ln_sf( File.("~/.ssh/#{name}"), File.('~/.ssh/current_key') ) end |
.skeleton_ssh_config ⇒ Object
33 34 35 36 37 38 |
# 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 ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/ssh_configurator.rb', line 15 def self.verify_ssh_config_exists full_config_path = File.('~/.ssh/config') unless File.exist? full_config_path File.write(full_config_path, skeleton_ssh_config) puts raise SystemExit end end |