module Billy::Util::Ssh

Public Class Methods

get_pub_key( type = :id_rsa ) click to toggle source
# File lib/billy/util/ssh.rb, line 14
def get_pub_key( type = :id_rsa )
  keys = pub_keys
  return nil unless !keys.nil? && keys.any?
  keys[ type ]
end
pub_keys() click to toggle source
# File lib/billy/util/ssh.rb, line 20
def pub_keys
  return nil unless ssh_folder_exists?
  res = Hash.new
  Dir[ ssh_root_path + '/*.pub' ].each do |f|
    key = File.basename( f, '.pub' ).to_sym
    res[ key ] = File.read( f )
  end
  res
end
ssh_folder_exists?() click to toggle source
# File lib/billy/util/ssh.rb, line 10
def ssh_folder_exists?
  File.exists?( ssh_root_path ) && File.directory?( ssh_root_path )
end
ssh_root_path() click to toggle source
# File lib/billy/util/ssh.rb, line 6
def ssh_root_path
  File.expand_path( "~/.ssh" )
end