class Krane::CLI::Krane

Constants

FAILURE_EXIT_CODE
TIMEOUT_EXIT_CODE

Public Class Methods

exit_on_failure?() click to toggle source
# File lib/krane/cli/krane.rb, line 70
def self.exit_on_failure?
  true
end
expand_options(task_options) click to toggle source
# File lib/krane/cli/krane.rb, line 20
def self.expand_options(task_options)
  task_options.each { |option_name, config| method_option(option_name, config) }
end

Public Instance Methods

deploy(namespace, context) click to toggle source
# File lib/krane/cli/krane.rb, line 56
def deploy(namespace, context)
  rescue_and_exit do
    DeployCommand.from_options(namespace, context, options)
  end
end
global_deploy(context) click to toggle source
# File lib/krane/cli/krane.rb, line 64
def global_deploy(context)
  rescue_and_exit do
    GlobalDeployCommand.from_options(context, options)
  end
end
render() click to toggle source
# File lib/krane/cli/krane.rb, line 26
def render
  rescue_and_exit do
    RenderCommand.from_options(options)
  end
end
restart(namespace, context) click to toggle source
# File lib/krane/cli/krane.rb, line 40
def restart(namespace, context)
  rescue_and_exit do
    RestartCommand.from_options(namespace, context, options)
  end
end
run_command(namespace, context) click to toggle source
# File lib/krane/cli/krane.rb, line 48
def run_command(namespace, context)
  rescue_and_exit do
    RunCommand.from_options(namespace, context, options)
  end
end
version() click to toggle source
# File lib/krane/cli/krane.rb, line 34
def version
  VersionCommand.from_options(options)
end

Private Instance Methods

rescue_and_exit() { || ... } click to toggle source
# File lib/krane/cli/krane.rb, line 76
      def rescue_and_exit
        yield
      rescue ::Krane::DeploymentTimeoutError
        exit(TIMEOUT_EXIT_CODE)
      rescue ::Krane::FatalDeploymentError
        exit(FAILURE_EXIT_CODE)
      rescue ::Krane::DurationParser::ParsingError => e
        STDERR.puts(<<~ERROR_MESSAGE)
          Error parsing duration
          #{e.message}. Duration must be a full ISO8601 duration or time value (e.g. 300s, 10m, 1h)
        ERROR_MESSAGE
        exit(FAILURE_EXIT_CODE)
      end