Module: Blimpy::Keys

Defined in:
lib/blimpy/keys.rb

Class Method Summary collapse

Class Method Details

.key_nameObject



17
18
19
# File 'lib/blimpy/keys.rb', line 17

def self.key_name
  "Blimpy-#{ENV['USER']}-#{Socket.gethostname}"
end

.public_keyObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/blimpy/keys.rb', line 5

def self.public_key
  filename = File.expand_path('~/.ssh/id_rsa.pub')
  unless File.exists? filename
    filename = File.expand_path('~/.ssh/id_dsa.pub')
    unless File.exists? filename
      raise Blimpy::SSHKeyNotFoundError, 'Expected either ~/.ssh/id_rsa.pub or ~/.ssh/id_dsa.pub but found neither'
    end
  end

  File.open(filename, 'r').read
end