class Shacho::Key

Public Class Methods

generate(account) click to toggle source
# File lib/shacho/key.rb, line 5
def self.generate(account)\
  account_path = "#{HEROKU_PREFIX}/accounts/#{account}/.ssh"
  if !File.exists?(account_path)
    FileUtils.mkdir_p account_path
    FileUtils.chmod 0700, "#{account_path}"
  end
  # TODO listen for options
  # TODO better way of suppressing bash output
  `ssh-keygen -f #{account_path}/id_rsa`
end
use(account) click to toggle source
# File lib/shacho/key.rb, line 16
def self.use(account)
  account_path = "#{HEROKU_PREFIX}/accounts/#{account}/.ssh"
  `heroku keys:add #{account_path}/id_rsa.pub`
end