Class: Ey::Core::Cli::Subcommand
- Inherits:
-
Belafonte::App
- Object
- Belafonte::App
- Ey::Core::Cli::Subcommand
- Includes:
- Helpers::Core
- Defined in:
- lib/ey-core/cli/subcommand.rb
Direct Known Subclasses
Accounts, Applications, Console, CurrentUser, Deploy, DockerRegistryLogin, EnvironmentVariables, Environments, Init, Login, Logout, Logs, Recipes::Apply, Recipes::Download, Recipes::Main, Recipes::Upload, Scp, Servers, Ssh, Status, TimeoutDeploy, Version, Web::Disable, Web::Enable, Web::Main, Web::Restart
Instance Method Summary collapse
-
#handle_core_error(e) ⇒ Object
TODO: a lot more errors that would could handle with nice messages, eventually this should probably be it’s own class.
- #run_handle ⇒ Object
- #setup ⇒ Object
Methods included from Helpers::Core
#core_account, #core_accounts, #core_application_for, #core_applications, #core_client, #core_environment_for, #core_environment_variables, #core_environments, #core_operator_and_environment_for, #core_server_for, #core_url, #core_yaml, #eyrc_yaml, included, #longest_length_by_name, #operator, #unauthenticated_core_client, #write_core_yaml
Instance Method Details
#handle_core_error(e) ⇒ Object
TODO: a lot more errors that would could handle with nice messages, eventually this should probably be it’s own class
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ey-core/cli/subcommand.rb', line 39 def handle_core_error(e) stderr.puts "Error: #{e.error_type}".red (e.response.body["errors"] || [e.]).each do || stderr.puts Wrapomatic.wrap(, indents: 1) end if e.is_a?(Ey::Core::Response::Unauthorized) stderr.puts "Check the contents of ~/.ey-core vs https://cloud.engineyard.com/cli" end raise SystemExit.new(255) end |
#run_handle ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ey-core/cli/subcommand.rb', line 20 def run_handle super rescue Ey::Core::Response::Error => e if ENV["DEBUG"] puts e.inspect puts e.backtrace end handle_core_error(e) rescue => e if ENV["DEBUG"] puts e.inspect puts e.backtrace end stderr.puts "Error:".red stderr.puts Wrapomatic.wrap(e., indents: 1) raise SystemExit.new(255) end |
#setup ⇒ Object
13 14 15 16 17 18 |
# File 'lib/ey-core/cli/subcommand.rb', line 13 def setup $stdout = stdout $stderr = stderr $stdin = stdin $kernel = kernel end |