Module: Dawn::CLI::Key

Extended by:
BaseCommands
Defined in:
lib/dawn/cli/commands/key.rb

Class Method Summary collapse

Methods included from BaseCommands

command, handle_abort_exception

Methods included from Helpers

#current_app, #current_app_name, #extract_app_in_dir, #extract_app_remote_from_git_config, #git, #git_add_dawn_remote, #git_dawn_remote?, #git_remotes, #git_remove_dawn_remote, #has_git?, #try_create_app

Methods included from OutputFormatter

#format_apps, #format_domains, #format_drains, #format_gears, #format_keys, #format_releases, #table_style

Class Method Details

.addObject

“Adds this machine’s sshkey to Dawn”



18
19
20
21
22
23
24
# File 'lib/dawn/cli/commands/key.rb', line 18

def self.add
  filename = File.join(Dir.home, ".ssh/id_rsa.pub")
  pubkey = File.read filename
  key    = Dawn::Key.create(key: pubkey)
rescue Excon::Errors::UnprocessableEntity => ex
  handle_abort_exception("dawn key add", ex)
end

.delete(id) ⇒ Object

“Delete a Key by ID”

Parameters:

  • id (String)


40
41
42
43
44
# File 'lib/dawn/cli/commands/key.rb', line 40

def self.delete(id)
  Dawn::Key.destroy(id: id)
rescue Excon::Errors::NotFound => ex
  handle_abort_exception("dawn key delete", ex)
end

.get(id) ⇒ Object

“Retrieve a Key by ID”

Parameters:

  • id (String)


30
31
32
33
34
# File 'lib/dawn/cli/commands/key.rb', line 30

def self.get(id)
  say Dawn::Key.find(id: id).key
rescue Excon::Errors::NotFound => ex
  handle_abort_exception("dawn key get", ex)
end

.listObject

“Lists all your Keys currently on dawn”



11
12
13
# File 'lib/dawn/cli/commands/key.rb', line 11

def self.list
  say format_keys(Dawn::Key.all)
end