class CfScript::Command::Base
Attributes
name[R]
type[R]
Public Class Methods
new(type, name)
click to toggle source
# File lib/cf_script/command/base.rb, line 15 def initialize(type, name) @type = type @name = name end
Public Instance Methods
good_run?(output, options = {})
click to toggle source
# File lib/cf_script/command/base.rb, line 32 def good_run?(output, options = {}) options[:check_status] = option_value(options, :check_status, true) options[:check_failed] = option_value(options, :check_failed, true) if options[:check_status] == true && !output.good? error 'cf exited with error' output.dump unless CfScript.config.runtime.echo_output return false end if output.no_api_endpoint? error "No API endpoint set" return false end if output.not_logged_in? error 'Not logged in' return false end if options[:check_failed] == true && output.failed? error 'FAILED' output.dump unless CfScript.config.runtime.echo_output return false end true end
line(env, bin, args)
click to toggle source
# File lib/cf_script/command/base.rb, line 20 def line(env, bin, args) Line.new(env, bin, type, name, args) end
option_value(options, key, default)
click to toggle source
# File lib/cf_script/command/base.rb, line 28 def option_value(options, key, default) options.key?(key) ? options[key] : default end
run(*args, &block)
click to toggle source
# File lib/cf_script/command/base.rb, line 24 def run(*args, &block) raise "run called in base command class" end