Class: EY::Tools::Console::CLI

Inherits:
EY::Tools::CLI::Base show all
Defined in:
lib/ey_tools/console.rb

Instance Method Summary collapse

Methods inherited from EY::Tools::CLI::Base

start

Instance Method Details

#consoleObject

Raises:

  • (NoCommandError)


18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ey_tools/console.rb', line 18

def console
  app_env = fetch_app_environment(options[:app], options[:environment], options[:account])

  hosts = ssh_hosts(options, app_env.environment)

  raise NoCommandError.new if hosts.size != 1

  exits = hosts.map do |host|
    system Escape.shell_command(['ssh', '-t', "#{app_env.environment.username}@#{host}", "cd /data/#{app_env.app.name}/current; RAILS_ENV=production bundle exec rails c"].compact)
    $?.exitstatus
  end
  exit exits.detect {|status| !status.zero?} || 0
end