Class: Aptible::CLI::Agent

Inherits:
Thor
  • Object
show all
Includes:
Helpers::Token, Subcommands::Apps, Subcommands::Config, Subcommands::DB, Subcommands::Domains, Subcommands::Logs, Subcommands::Ps, Subcommands::Rebuild, Subcommands::Restart, Subcommands::SSH, Thor::Actions
Defined in:
lib/aptible/cli/agent.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Subcommands::SSH

included

Methods included from Subcommands::Restart

included

Methods included from Subcommands::Rebuild

included

Methods included from Subcommands::Ps

included

Methods included from Subcommands::Logs

included

Methods included from Subcommands::Domains

included

Methods included from Subcommands::DB

included

Methods included from Subcommands::Config

included

Methods included from Subcommands::Apps

included

Methods included from Helpers::Token

#current_token_hash, #fetch_token, #save_token, #token_file

Class Method Details

.exit_on_failure? ⇒ Boolean

Forward return codes on failures.

Returns:

  • (Boolean)


39
40
41
# File 'lib/aptible/cli/agent.rb', line 39

def self.exit_on_failure?
  true
end

Instance Method Details

#login ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/aptible/cli/agent.rb', line 51

def 
  email = options[:email] || ask('Email: ')
  password = options[:password] || ask('Password: ', echo: false)
  puts ''

  begin
    token = Aptible::Auth::Token.create(email: email, password: password)
  rescue OAuth2::Error
    raise Thor::Error, 'Could not authenticate with given credentials'
  end

  save_token(token.access_token)
  puts "Token written to #{token_file}"
end

#version ⇒ Object



44
45
46
# File 'lib/aptible/cli/agent.rb', line 44

def version
  puts "aptible-cli v#{Aptible::CLI::VERSION}"
end