class Omc::Cli

Public Instance Methods

console(stack) click to toggle source
# File lib/omc/cli.rb, line 42
def console(stack)
  command = StackCommand.new(aws_account, user, stack, app: options[:app], layer: options[:layer])
  command.console
end
db(stack) click to toggle source
# File lib/omc/cli.rb, line 49
def db(stack)
  command = StackCommand.new(aws_account, user, stack, app: options[:app], layer: options[:layer])
  command.db
end
ssh(stack) click to toggle source
# File lib/omc/cli.rb, line 15
def ssh(stack)
  command = StackCommand.new(
    aws_account,
    user,
    stack,
    layer: options[:layer],
    forward_agent: options[:forward_agent],
    remote_forward: options[:remote_forward]
  )
  command.ssh
end
ssh_exec(stack, user_command) click to toggle source
# File lib/omc/cli.rb, line 28
def ssh_exec(stack, user_command)
  command = StackCommand.new(
    aws_account,
    user,
    stack,
    layer: options[:layer],
    forward_agent: options[:forward_agent],
    remote_forward: options[:remote_forward]
  )
  command.ssh_and_execute user_command
end
status(stack) click to toggle source
# File lib/omc/cli.rb, line 62
def status(stack)
  command = StackCommand.new(aws_account, user, stack, app: options[:app], layer: options[:layer])
  command.status(self)
end
unicorn(action, stack) click to toggle source
# File lib/omc/cli.rb, line 56
def unicorn(action, stack)
  command = StackCommand.new(aws_account, user, stack, app: options[:app])
  command.unicorn(action)
end

Private Instance Methods

account() click to toggle source
# File lib/omc/cli.rb, line 76
def account
  options[:account] || config.account || abort("Must specify account")
end
aws_account() click to toggle source
# File lib/omc/cli.rb, line 72
def aws_account
  vault.account(account) || abort("Account #{account.inspect} not configured")
end
config() click to toggle source
# File lib/omc/cli.rb, line 80
def config
  @config ||= Omc::Config.load
end
user() click to toggle source
# File lib/omc/cli.rb, line 68
def user
  aws_account.users.first || abort("No users configured under #{account.inspect}")
end
vault() click to toggle source
# File lib/omc/cli.rb, line 84
def vault
  AwsCredVault::Toml.new File.join(ENV['HOME'], '.aws_cred_vault')
end