module Aptible::CLI::Helpers::AppOrDatabase

Public Class Methods

included(base) click to toggle source
# File lib/aptible/cli/helpers/app_or_database.rb, line 28
def self.included(base)
  base.extend(ClassMethods)
end

Public Instance Methods

ensure_app_or_database(options = {}) click to toggle source
# 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