mixlib-config 3.0.1 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00aac666bc563771555dab524712c1bb1175b0bea5e41d017251843895cbf7b0
4
- data.tar.gz: 1cfb6b8645a7237986f006b0423c8e3ec145d712c3cdecff60872e82aa586d72
3
+ metadata.gz: 542f1c9f7daff1297b70799397e6f44dba7896522e89334e71496db690802013
4
+ data.tar.gz: f2383ad0c71049dab95ceeac81d39d7b8ed1d8cb2e9a6ed45ac29acaa0d63838
5
5
  SHA512:
6
- metadata.gz: 6bf5afed3c54518eed406a85a5547d246db60b55b8ba8eb1ecfa2f6822449671c288319c6e916e8563a7704ed51c32572a4b177c9684591f5a295c3a66d07f4a
7
- data.tar.gz: 4a76a15a08ecdb677bd6895de3ca8c42daea9456c9a33bc42095e100cbd759dd303cc7fa45548f1804e4909acf209c7498a0850fbfe1d2b9b3a50396e1390860
6
+ metadata.gz: d4137a9a0747261ad42cc1f3035ab6136823ee3c89666e7adf041e36190cd24179e0eee5711686011ab7c1e7efead2242aef88c6f9c0e03bfee8ef41509492be
7
+ data.tar.gz: 22248d0a227c55598fa81debb29a0eaa9436d27192bfbd45beb091b0ace555b4abd4783f09ef7c1febca965b386320268dada9fe5f45a94485cc266695144a9b
@@ -33,11 +33,11 @@ module Mixlib
33
33
  class << base; attr_accessor :config_context_lists; end
34
34
  class << base; attr_accessor :config_context_hashes; end
35
35
  class << base; attr_accessor :config_parent; end
36
- base.configuration = Hash.new
37
- base.configurables = Hash.new
38
- base.config_contexts = Hash.new
39
- base.config_context_lists = Hash.new
40
- base.config_context_hashes = Hash.new
36
+ base.configuration = ({})
37
+ base.configurables = ({})
38
+ base.config_contexts = ({})
39
+ base.config_context_lists = ({})
40
+ base.config_context_hashes = ({})
41
41
  base.initialize_mixlib_config
42
42
  end
43
43
 
@@ -165,8 +165,8 @@ module Mixlib
165
165
 
166
166
  # Resets all config options to their defaults.
167
167
  def reset
168
- self.configuration = Hash.new
169
- config_contexts.values.each { |config_context| config_context.reset }
168
+ self.configuration = ({})
169
+ config_contexts.values.each(&:reset)
170
170
  end
171
171
 
172
172
  # Makes a copy of any non-default values.
@@ -372,6 +372,7 @@ module Mixlib
372
372
  if config_contexts.key?(symbol)
373
373
  raise ReopenedConfigContextWithConfigurableError, "Cannot redefine config_context #{symbol} as a configurable value"
374
374
  end
375
+
375
376
  configurables[symbol] = Configurable.new(symbol)
376
377
  define_attr_accessor_methods(symbol)
377
378
  end
@@ -531,9 +532,10 @@ module Mixlib
531
532
  # <ArgumentError>:: if value is set to something other than true, false, or :warn
532
533
  #
533
534
  def config_strict_mode=(value)
534
- if ![ true, false, :warn, nil ].include?(value)
535
+ unless [ true, false, :warn, nil ].include?(value)
535
536
  raise ArgumentError, "config_strict_mode must be true, false, nil or :warn"
536
537
  end
538
+
537
539
  @config_strict_mode = value
538
540
  end
539
541
 
@@ -567,7 +569,10 @@ module Mixlib
567
569
  def apply_nested_hash(hash)
568
570
  hash.each do |k, v|
569
571
  if v.is_a? Hash
570
- internal_get(k.to_sym).apply_nested_hash(v)
572
+ # If loading from hash, and we reference a context that doesn't exist
573
+ # and warning/strict is off, we need to create the config context that we expected to be here.
574
+ context = internal_get(k.to_sym) || config_context(k.to_sym)
575
+ context.apply_nested_hash(v)
571
576
  else
572
577
  internal_set(k.to_sym, v)
573
578
  end
@@ -19,7 +19,7 @@
19
19
  module Mixlib
20
20
  module Config
21
21
 
22
- VERSION = "3.0.1".freeze
22
+ VERSION = "3.0.5".freeze
23
23
 
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixlib-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-23 00:00:00.000000000 Z
11
+ date: 2019-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb