class Omnibus::Command::Base
Public Class Methods
dispatch(m, args, options, config)
click to toggle source
Calls superclass method
# File lib/omnibus/cli/base.rb, line 25 def dispatch(m, args, options, config) # Handle the case where Thor thinks a trailing --help is actually an # argument and blows up... if args.length > 1 && !(args & Thor::HELP_MAPPINGS).empty? args -= Thor::HELP_MAPPINGS args.insert(-2, "help") end super end
exit_on_failure?()
click to toggle source
# File lib/omnibus/cli/base.rb, line 36 def exit_on_failure? true end
new(args, options, config)
click to toggle source
Calls superclass method
# File lib/omnibus/cli/base.rb, line 43 def initialize(args, options, config) super(args, options, config) # Set the log_level if @options[:log_level] Omnibus.logger.level = @options[:log_level] end # Do not load the Omnibus config if we are asking for help or the version if %w{help version}.include?(config[:current_command].name) log.debug(log_key) { "Skipping Omnibus loading (detected help or version)" } return end if File.exist?(@options[:config]) log.info(log_key) { "Using config from '#{@options[:config]}'" } Omnibus.load_configuration(@options[:config]) else if @options[:config] == Omnibus::DEFAULT_CONFIG log.debug(log_key) { "Config file not given - using defaults" } else raise "The given config file '#{@options[:config]}' does not exist!" end end @options[:override].each do |key, value| if %w{true false nil}.include?(value) log.debug(log_key) { "Detected #{value.inspect} should be an object" } value = { "true" => true, "false" => false, "nil" => nil }[value] end if value =~ /\A[[:digit:]]+\Z/ log.debug(log_key) { "Detected #{value.inspect} should be an integer" } value = value.to_i end if Config.respond_to?(key) log.debug(log_key) { "Setting Config.#{key} = #{value.inspect}" } Config.send(key, value) else log.debug (log_key) { "Skipping option '#{key}' - not a config option" } end end end
Public Instance Methods
help(*)
click to toggle source
Calls superclass method
# File lib/omnibus/cli/base.rb, line 110 def help(*) super end