mixlib-config 2.0.0.rc.1 → 2.0.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mixlib/config.rb +3 -2
- data/lib/mixlib/config/version.rb +1 -1
- data/spec/mixlib/config_spec.rb +2 -0
- metadata +1 -1
data/lib/mixlib/config.rb
CHANGED
@@ -31,6 +31,7 @@ module Mixlib
|
|
31
31
|
base.configuration = Hash.new
|
32
32
|
base.configurables = Hash.new
|
33
33
|
base.config_contexts = Array.new
|
34
|
+
base.config_strict_mode false
|
34
35
|
end
|
35
36
|
|
36
37
|
# Loads a given ruby file, and runs instance_eval against it in the context of the current
|
@@ -237,7 +238,7 @@ module Mixlib
|
|
237
238
|
#
|
238
239
|
def config_strict_mode(value = NOT_PASSED)
|
239
240
|
if value == NOT_PASSED
|
240
|
-
@config_strict_mode
|
241
|
+
@config_strict_mode
|
241
242
|
else
|
242
243
|
self.config_strict_mode = value
|
243
244
|
end
|
@@ -307,7 +308,7 @@ module Mixlib
|
|
307
308
|
else
|
308
309
|
if config_strict_mode == :warn
|
309
310
|
Chef::Log.warn("Setting unsupported config value #{method_name}..")
|
310
|
-
elsif
|
311
|
+
elsif config_strict_mode
|
311
312
|
raise UnknownConfigOptionError, "Cannot set unsupported config value #{method_name}."
|
312
313
|
end
|
313
314
|
configuration[method_symbol] = value
|
data/spec/mixlib/config_spec.rb
CHANGED
@@ -350,6 +350,7 @@ describe Mixlib::Config do
|
|
350
350
|
@klass = Class.new
|
351
351
|
@klass.extend(::Mixlib::Config)
|
352
352
|
@klass.class_eval do
|
353
|
+
configurable :x
|
353
354
|
config_context(:blah) do
|
354
355
|
default :x, 5
|
355
356
|
end
|
@@ -389,6 +390,7 @@ describe Mixlib::Config do
|
|
389
390
|
default :x, 5
|
390
391
|
end
|
391
392
|
end
|
393
|
+
configurable :x
|
392
394
|
end
|
393
395
|
end
|
394
396
|
|