mixlib-config 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mixlib/config.rb +6 -5
- data/lib/mixlib/config/version.rb +1 -1
- data/spec/mixlib/config_spec.rb +11 -11
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed2d3dd671f4a76756e5f8c758f11acc83e8a940
|
4
|
+
data.tar.gz: fdb79719393a379367ab99972b991e40c5c3bcaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39dad5181d28055d3beee67ed970193c28fcca6f4f665372c0daf431b0e56ce45b447d96fcea27ee272795532c40164addaf1970da88f790d52dfaa401c5b45f
|
7
|
+
data.tar.gz: d240546f416dbda68d141848a6528244c8d14f2055d2cd74c84f2deb30f150dbd9fe9dcba4971782d5467166185086b80c1286b7cde0c97d31b24fa84cd96945
|
data/lib/mixlib/config.rb
CHANGED
@@ -50,7 +50,7 @@ module Mixlib
|
|
50
50
|
# Pass Mixlib::Config.configure() a block, and it will yield itself
|
51
51
|
#
|
52
52
|
# === Parameters
|
53
|
-
# block<Block>:: A block that is called with self.configuration as the
|
53
|
+
# block<Block>:: A block that is called with self.configuration as the argument.
|
54
54
|
def configure(&block)
|
55
55
|
block.call(self.configuration)
|
56
56
|
end
|
@@ -92,9 +92,10 @@ module Mixlib
|
|
92
92
|
# === Returns
|
93
93
|
# <True>:: If the config option exists
|
94
94
|
# <False>:: If the config option does not exist
|
95
|
-
def
|
95
|
+
def key?(key)
|
96
96
|
self.configuration.has_key?(key.to_sym)
|
97
97
|
end
|
98
|
+
alias_method :has_key?, :key?
|
98
99
|
|
99
100
|
# Resets a config option to its default.
|
100
101
|
#
|
@@ -402,7 +403,7 @@ module Mixlib
|
|
402
403
|
# === Parameters
|
403
404
|
# symbol<Symbol>:: Name of the method (variable setter)
|
404
405
|
# value<Object>:: Value to be set in config hash
|
405
|
-
#
|
406
|
+
#
|
406
407
|
def internal_set(symbol,value)
|
407
408
|
if configurables.has_key?(symbol)
|
408
409
|
configurables[symbol].set(self.configuration, value)
|
@@ -410,9 +411,9 @@ module Mixlib
|
|
410
411
|
config_contexts[symbol].restore(value)
|
411
412
|
else
|
412
413
|
if config_strict_mode == :warn
|
413
|
-
Chef::Log.warn("Setting unsupported config value #{
|
414
|
+
Chef::Log.warn("Setting unsupported config value #{symbol}.")
|
414
415
|
elsif config_strict_mode
|
415
|
-
raise UnknownConfigOptionError, "Cannot set unsupported config value #{
|
416
|
+
raise UnknownConfigOptionError, "Cannot set unsupported config value #{symbol}."
|
416
417
|
end
|
417
418
|
configuration[symbol] = value
|
418
419
|
end
|
data/spec/mixlib/config_spec.rb
CHANGED
@@ -102,23 +102,23 @@ describe Mixlib::Config do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
it "raises an error when you get an arbitrary config option with .y" do
|
105
|
-
lambda { StrictClass.y }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
|
105
|
+
lambda { StrictClass.y }.should raise_error(Mixlib::Config::UnknownConfigOptionError, "Reading unsupported config value y.")
|
106
106
|
end
|
107
107
|
|
108
108
|
it "raises an error when you get an arbitrary config option with [:y]" do
|
109
|
-
lambda { StrictClass[:y] }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
|
109
|
+
lambda { StrictClass[:y] }.should raise_error(Mixlib::Config::UnknownConfigOptionError, "Reading unsupported config value y.")
|
110
110
|
end
|
111
111
|
|
112
112
|
it "raises an error when you set an arbitrary config option with .y = 10" do
|
113
|
-
lambda { StrictClass.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
|
113
|
+
lambda { StrictClass.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError, "Cannot set unsupported config value y.")
|
114
114
|
end
|
115
115
|
|
116
|
-
it "raises an error when you
|
117
|
-
lambda { StrictClass.y 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
|
116
|
+
it "raises an error when you set an arbitrary config option with .y 10" do
|
117
|
+
lambda { StrictClass.y 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError, "Cannot set unsupported config value y.")
|
118
118
|
end
|
119
119
|
|
120
|
-
it "raises an error when you
|
121
|
-
lambda { StrictClass[:y] = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
|
120
|
+
it "raises an error when you set an arbitrary config option with [:y] = 10" do
|
121
|
+
lambda { StrictClass[:y] = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError, "Cannot set unsupported config value y.")
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -225,7 +225,7 @@ describe Mixlib::Config do
|
|
225
225
|
raise NopeError, "NOPE"
|
226
226
|
end
|
227
227
|
end
|
228
|
-
|
228
|
+
|
229
229
|
it 'Normal classes call the extra method' do
|
230
230
|
normal_class = Class.new
|
231
231
|
normal_class.extend(::Mixlib::Config)
|
@@ -887,7 +887,7 @@ describe Mixlib::Config do
|
|
887
887
|
end
|
888
888
|
|
889
889
|
it "The nested class does not allow you to set arbitrary config options" do
|
890
|
-
lambda { StrictClass2.c.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
|
890
|
+
lambda { StrictClass2.c.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError, "Cannot set unsupported config value y.")
|
891
891
|
end
|
892
892
|
end
|
893
893
|
|
@@ -900,11 +900,11 @@ describe Mixlib::Config do
|
|
900
900
|
end
|
901
901
|
|
902
902
|
it "The parent class does not allow you to set arbitrary config options" do
|
903
|
-
lambda { StrictClass3.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
|
903
|
+
lambda { StrictClass3.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError, "Cannot set unsupported config value y.")
|
904
904
|
end
|
905
905
|
|
906
906
|
it "The nested class does not allow you to set arbitrary config options" do
|
907
|
-
lambda { StrictClass3.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError)
|
907
|
+
lambda { StrictClass3.y = 10 }.should raise_error(Mixlib::Config::UnknownConfigOptionError, "Cannot set unsupported config value y.")
|
908
908
|
end
|
909
909
|
end
|
910
910
|
|
metadata
CHANGED
@@ -1,59 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixlib-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
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:
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.99'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.99'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: A class based configuration library
|
56
|
-
email:
|
56
|
+
email: legal@chef.io
|
57
57
|
executables: []
|
58
58
|
extensions: []
|
59
59
|
extra_rdoc_files:
|
@@ -64,16 +64,17 @@ files:
|
|
64
64
|
- NOTICE
|
65
65
|
- README.md
|
66
66
|
- Rakefile
|
67
|
+
- lib/mixlib/config.rb
|
67
68
|
- lib/mixlib/config/configurable.rb
|
68
69
|
- lib/mixlib/config/reopened_config_context_with_configurable_error.rb
|
69
70
|
- lib/mixlib/config/reopened_configurable_with_config_context_error.rb
|
70
71
|
- lib/mixlib/config/unknown_config_option_error.rb
|
71
72
|
- lib/mixlib/config/version.rb
|
72
|
-
- lib/mixlib/config.rb
|
73
73
|
- spec/mixlib/config_spec.rb
|
74
74
|
- spec/spec_helper.rb
|
75
|
-
homepage: http://www.
|
76
|
-
licenses:
|
75
|
+
homepage: http://www.chef.io
|
76
|
+
licenses:
|
77
|
+
- Apache-2.0
|
77
78
|
metadata: {}
|
78
79
|
post_install_message:
|
79
80
|
rdoc_options: []
|
@@ -81,17 +82,17 @@ require_paths:
|
|
81
82
|
- lib
|
82
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
84
|
requirements:
|
84
|
-
- -
|
85
|
+
- - ">="
|
85
86
|
- !ruby/object:Gem::Version
|
86
87
|
version: '0'
|
87
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
89
|
requirements:
|
89
|
-
- -
|
90
|
+
- - ">="
|
90
91
|
- !ruby/object:Gem::Version
|
91
92
|
version: '0'
|
92
93
|
requirements: []
|
93
94
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.4.5
|
95
96
|
signing_key:
|
96
97
|
specification_version: 4
|
97
98
|
summary: A class based configuration library
|