Module: Aptible::CLI::Helpers::AppOrDatabase

Includes:
App, Database
Defined in:
lib/aptible/cli/helpers/app_or_database.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary

Constants included from Token

Token::TOKEN_ENV_VAR

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Database

#clone_database, #databases_from_handle, #ensure_database, #find_credential, #find_database_image, #local_url, #render_database, #replicate_database, #validate_image_type, #with_local_tunnel, #with_postgres_tunnel

Methods included from Ssh

#connect_to_ssh_portal, #exit_with_ssh_portal, #with_ssh_cmd

Methods included from ConfigPath

#aptible_config_path

Methods included from Environment

#ensure_default_environment, #ensure_environment, #environment_from_handle, #scoped_environments

Methods included from Token

#current_token_hash, #fetch_token, #save_token, #token_file

Methods included from App

#apps_from_handle, #ensure_app, #ensure_service, #extract_env, #validate_env_key!, #validate_env_pair!

Class Method Details

.included(base) ⇒ Object



28
29
30
# File 'lib/aptible/cli/helpers/app_or_database.rb', line 28

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#ensure_app_or_database(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/aptible/cli/helpers/app_or_database.rb', line 15

def ensure_app_or_database(options = {})
  if options[:app] && options[:database]
    m = 'You must specify only one of --app and --database'
    raise Thor::Error, m
  end

  if options[:database]
    ensure_database(options.merge(db: options[:database]))
  else
    ensure_app(options)
  end
end