lib/omnibus/cli/base.rb in omnibus-3.2.2 vs lib/omnibus/cli/base.rb in omnibus-4.0.0.beta.1
- old
+ new
@@ -44,46 +44,43 @@
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 { 'Skipping Omnibus loading (detected help or version)' }
+ log.debug(log_key) { 'Skipping Omnibus loading (detected help or version)' }
return
end
if File.exist?(@options[:config])
- log.info { "Using config from '#{@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 { 'Config file not given - using defaults' }
+ 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 { "Detected #{value.inspect} should be an object" }
+ 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 { "Detected #{value.inspect} should be an integer" }
+ log.debug(log_key) { "Detected #{value.inspect} should be an integer" }
value = value.to_i
end
if Config.respond_to?(key)
- log.debug { "Setting Config.#{key} = #{value.inspect}" }
+ log.debug(log_key) { "Setting Config.#{key} = #{value.inspect}" }
Config.send(key, value)
else
- log.debug { "Skipping option '#{key}' - not a config option" }
+ log.debug (log_key){ "Skipping option '#{key}' - not a config option" }
end
end
-
- log.debug { 'Processing Omnibus configuration...' }
- Omnibus.process_configuration
end
class_option :config,
desc: 'Path to the Omnibus config file',
aliases: '-c',
@@ -91,12 +88,12 @@
default: Omnibus::DEFAULT_CONFIG
class_option :log_level,
desc: 'The log level',
aliases: '-l',
type: :string,
- enum: %w(fatal error warn info debug),
- lazy_default: 'info'
+ enum: Logger::LEVELS.map(&:downcase),
+ default: 'info'
class_option :override,
desc: 'Override one or more Omnibus config options',
aliases: '-o',
type: :hash,
default: {}
@@ -109,9 +106,5 @@
def help(*)
super
end
end
end
-
-# Include the deprecations from previous versions of Omnibus. This should be
-# removed in the next major version of Omnibus.
-require_relative 'deprecated'