mixlib-config 1.1.2 → 2.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.rdoc → README.md} +10 -10
- data/Rakefile +11 -54
- data/lib/mixlib/config.rb +224 -61
- data/lib/mixlib/config/configurable.rb +55 -0
- data/{features/support/env.rb → lib/mixlib/config/invalid_value_error.rb} +9 -16
- data/lib/mixlib/config/unknown_config_option_error.rb +24 -0
- data/{features/support/config_it.rb → lib/mixlib/config/version.rb} +9 -12
- data/spec/mixlib/config_spec.rb +337 -26
- data/spec/spec_helper.rb +8 -1
- metadata +80 -55
- data/.gitignore +0 -6
- data/VERSION.yml +0 -5
- data/features/mixlib_config.feature +0 -31
- data/features/step_definitions/mixlib_config_steps.rb +0 -0
- data/features/steps/config_steps.rb +0 -66
- data/features/support/bobo.config +0 -3
- data/spec/spec.opts +0 -4
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
$TESTING=true
|
2
2
|
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
|
3
3
|
|
4
|
+
require 'rspec'
|
4
5
|
require 'mixlib/config'
|
5
6
|
|
6
7
|
class ConfigIt
|
7
8
|
extend Mixlib::Config
|
8
|
-
end
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.filter_run :focus => true
|
13
|
+
config.run_all_when_everything_filtered = true
|
14
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
15
|
+
end
|
metadata
CHANGED
@@ -1,81 +1,106 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixlib-config
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
version: 1.1.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0.rc.1
|
5
|
+
prerelease: 6
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Opscode, Inc.
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2013-09-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rdoc
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: A class based configuration library
|
22
63
|
email: info@opscode.com
|
23
64
|
executables: []
|
24
|
-
|
25
65
|
extensions: []
|
26
|
-
|
27
|
-
extra_rdoc_files:
|
66
|
+
extra_rdoc_files:
|
28
67
|
- LICENSE
|
29
|
-
- README.
|
30
|
-
files:
|
31
|
-
- .gitignore
|
68
|
+
- README.md
|
69
|
+
files:
|
32
70
|
- LICENSE
|
33
71
|
- NOTICE
|
34
|
-
- README.
|
72
|
+
- README.md
|
35
73
|
- Rakefile
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
- features/support/bobo.config
|
41
|
-
- features/support/config_it.rb
|
42
|
-
- features/support/env.rb
|
74
|
+
- lib/mixlib/config/configurable.rb
|
75
|
+
- lib/mixlib/config/invalid_value_error.rb
|
76
|
+
- lib/mixlib/config/unknown_config_option_error.rb
|
77
|
+
- lib/mixlib/config/version.rb
|
43
78
|
- lib/mixlib/config.rb
|
44
79
|
- spec/mixlib/config_spec.rb
|
45
|
-
- spec/spec.opts
|
46
80
|
- spec/spec_helper.rb
|
47
|
-
has_rdoc: true
|
48
81
|
homepage: http://www.opscode.com
|
49
82
|
licenses: []
|
50
|
-
|
51
83
|
post_install_message:
|
52
|
-
rdoc_options:
|
53
|
-
|
54
|
-
require_paths:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
55
86
|
- lib
|
56
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
88
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
|
63
|
-
version: "0"
|
64
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
94
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
|
70
|
-
- 0
|
71
|
-
version: "0"
|
95
|
+
requirements:
|
96
|
+
- - ! '>'
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.3.1
|
72
99
|
requirements: []
|
73
|
-
|
74
100
|
rubyforge_project:
|
75
|
-
rubygems_version: 1.
|
101
|
+
rubygems_version: 1.8.23
|
76
102
|
signing_key:
|
77
103
|
specification_version: 3
|
78
|
-
summary: A class based
|
79
|
-
test_files:
|
80
|
-
|
81
|
-
- spec/spec_helper.rb
|
104
|
+
summary: A class based configuration library
|
105
|
+
test_files: []
|
106
|
+
has_rdoc:
|
data/.gitignore
DELETED
data/VERSION.yml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
Feature: Configure an application
|
2
|
-
In order to make it trivial to configure an application
|
3
|
-
As a Developer
|
4
|
-
I want to utilize a simple configuration object
|
5
|
-
|
6
|
-
Scenario: Set a configuration option to a string
|
7
|
-
Given a configuration class 'ConfigIt'
|
8
|
-
When I set 'foo' to 'bar' in configuration class 'ConfigIt'
|
9
|
-
Then config option 'foo' is 'bar'
|
10
|
-
|
11
|
-
Scenario: Set the same configuration option to different strings for two configuration classes
|
12
|
-
Given a configuration class 'ConfigIt'
|
13
|
-
And a configuration class 'ConfigItToo'
|
14
|
-
When I set 'foo' to 'bar' in configuration class 'ConfigIt'
|
15
|
-
And I set 'foo' to 'bar2' in configuration class 'ConfigItToo'
|
16
|
-
Then in configuration class 'ConfigItToo' config option 'foo' is 'bar2'
|
17
|
-
And in configuration class 'ConfigIt' config option 'foo' is 'bar'
|
18
|
-
|
19
|
-
Scenario: Set a configuration option to an Array
|
20
|
-
Given a configuration class 'ConfigIt'
|
21
|
-
When I set 'foo' to:
|
22
|
-
|key|
|
23
|
-
|bar|
|
24
|
-
|baz|
|
25
|
-
Then an array is returned for 'foo'
|
26
|
-
|
27
|
-
Scenario: Set a configuration option from a file
|
28
|
-
Given a configuration file 'bobo.config'
|
29
|
-
When I load the configuration
|
30
|
-
Then config option 'foo' is 'bar'
|
31
|
-
And config option 'baz' is 'snarl'
|
File without changes
|
@@ -1,66 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
Given /^a configuration class '(.+)'$/ do |classname|
|
20
|
-
end
|
21
|
-
|
22
|
-
When /^I set '(.+)' to '(.+)' in configuration class '(.+)'$/ do |key, value, classname|
|
23
|
-
|
24
|
-
#ConfigIt[key.to_sym] = value
|
25
|
-
if classname == 'ConfigIt'
|
26
|
-
ConfigIt[key.to_sym] = value
|
27
|
-
elsif classname == 'ConfigItToo'
|
28
|
-
ConfigItToo[key.to_sym] = value
|
29
|
-
else
|
30
|
-
raise ArgumentError, "configuration class must be ConfigIt or ConfigItToo"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
Then /^config option '(.+)' is '(.+)'$/ do |key, value|
|
35
|
-
ConfigIt[key.to_sym].should == value
|
36
|
-
end
|
37
|
-
|
38
|
-
Then /^in configuration class '(.+)' config option '(.+)' is '(.+)'$/ do |classname, key, value|
|
39
|
-
if classname == 'ConfigIt'
|
40
|
-
ConfigIt[key.to_sym].should == value
|
41
|
-
elsif classname == 'ConfigItToo'
|
42
|
-
ConfigItToo[key.to_sym].should == value
|
43
|
-
else
|
44
|
-
raise ArgumentError, "configuration class must be ConfigIt or ConfigItToo"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
When /^I set '(.+)' to:$/ do |key, foo_table|
|
49
|
-
ConfigIt[key.to_sym] = Array.new
|
50
|
-
foo_table.hashes.each do |hash|
|
51
|
-
ConfigIt[key.to_sym] << hash['key']
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
Then /^an array is returned for '(.+)'$/ do |key|
|
56
|
-
ConfigIt[key.to_sym].should be_a_kind_of(Array)
|
57
|
-
end
|
58
|
-
|
59
|
-
Given /^a configuration file '(.+)'$/ do |filename|
|
60
|
-
@config_file = File.join(File.dirname(__FILE__), "..", "support", filename)
|
61
|
-
end
|
62
|
-
|
63
|
-
When /^I load the configuration$/ do
|
64
|
-
ConfigIt.from_file(@config_file)
|
65
|
-
end
|
66
|
-
|
data/spec/spec.opts
DELETED