Module: Dawn::CLI::BaseCommands

Includes:
Helpers
Included in:
App, Auth, Domain, Drain, Env, Key, Local, Release
Defined in:
lib/dawn/cli/commands/base_commands.rb

Instance Method Summary collapse

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

Instance Method Details

#command(sym, *args, &block) ⇒ Object

Parameters:

  • sym (Symbol)
  • *args (Array<Objects>)


12
13
14
15
16
17
18
19
# File 'lib/dawn/cli/commands/base_commands.rb', line 12

def command(sym, *args, &block)
  if Dawn::CLI.no_operation
    say "#{self}.#{sym}(#{args.map(&:inspect).join(", ")})"
  else
    send(sym, *args, &block)
  end
  sym
end

#handle_abort_exception(basename, ex) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/dawn/cli/commands/base_commands.rb', line 21

def handle_abort_exception(basename, ex)
  error_obj = JSON.load(ex.response.body) rescue nil
  if error_obj
    abort "#{basename}: (#{error_obj["id"]}) #{error_obj["message"]} #{error_obj["error"]}"
  else
    abort "#{basename}: has failed for some unknown reason"
  end
end