Class: UploadKeyCommand

Inherits:
Command show all
Defined in:
lib/ukku/upload_key_command.rb

Instance Method Summary collapse

Methods inherited from Command

#load_app_info

Instance Method Details

#execute(args) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ukku/upload_key_command.rb', line 2

def execute(args)
  app_info = load_app_info(args)
  conn = Connection.new(app_info)

  key_file = args['PUBLIC_KEY_FILE']

  puts "Uploading key '#{key_file}' ... "
  conn.execute("gitreceive upload-key ukku") do |p|
    p.communicate IO.read(File.expand_path(key_file))
  end
  puts "Done!"

  puts
  puts "*********************************************************************"
  puts "ATTENTION: Add the following to '~/.ssh/config' before deploying"
  puts "(create the file if necessary; erase any other entry with same host):"
  puts
  puts "Host #{host}"
  puts "    User git"
  puts "    IdentityFile #{key_file}"
  puts "*********************************************************************"
end