opscode-mixlib-config 1.0.9 → 1.0.10
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.
- data/.gitignore +5 -0
- data/NOTICE +27 -0
- data/VERSION.yml +1 -1
- data/features/mixlib_config.feature +23 -0
- data/features/step_definitions/mixlib_config_steps.rb +0 -0
- data/features/steps/config_steps.rb +48 -0
- data/features/support/bobo.config +3 -0
- data/features/support/config_it.rb +24 -0
- data/features/support/env.rb +31 -0
- data/lib/mixlib/config.rb +11 -13
- data/mixlib-config.gemspec +53 -0
- metadata +13 -3
data/NOTICE
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Mixin::Config NOTICE
|
2
|
+
=================
|
3
|
+
|
4
|
+
Developed at Opscode (http://www.opscode.com).
|
5
|
+
|
6
|
+
* Copyright 2009, Opscode, Inc. <legal@opscode.com>
|
7
|
+
|
8
|
+
Mixin::Config incorporates code from Chef. The Chef notice file follows:
|
9
|
+
|
10
|
+
Chef NOTICE
|
11
|
+
===========
|
12
|
+
|
13
|
+
Developed at Opscode (http://www.opscode.com).
|
14
|
+
|
15
|
+
Contributors and Copyright holders:
|
16
|
+
|
17
|
+
* Copyright 2008, Adam Jacob <adam@opscode.com>
|
18
|
+
* Copyright 2008, Arjuna Christensen <aj@hjksolutions.com>
|
19
|
+
* Copyright 2008, Bryan McLellan <btm@loftninjas.org>
|
20
|
+
* Copyright 2008, Ezra Zygmuntowicz <ezra@engineyard.com>
|
21
|
+
* Copyright 2009, Sean Cribbs <seancribbs@gmail.com>
|
22
|
+
* Copyright 2009, Christopher Brown <cb@opscode.com>
|
23
|
+
* Copyright 2009, Thom May <thom@clearairturbulence.org>
|
24
|
+
|
25
|
+
Chef incorporates code modified from Open4 (http://www.codeforpeople.com/lib/ruby/open4/), which was written by Ara T. Howard.
|
26
|
+
|
27
|
+
Chef incorporates code modified from Merb (http://www.merbivore.com), which is Copyright (c) 2008 Engine Yard.
|
data/VERSION.yml
CHANGED
@@ -0,0 +1,23 @@
|
|
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
|
8
|
+
When I set 'foo' to 'bar'
|
9
|
+
Then config option 'foo' is 'bar'
|
10
|
+
|
11
|
+
Scenario: Set a configuration option to an Array
|
12
|
+
Given a configuration class
|
13
|
+
When I set 'foo' to:
|
14
|
+
|key|
|
15
|
+
|bar|
|
16
|
+
|baz|
|
17
|
+
Then an array is returned for 'foo'
|
18
|
+
|
19
|
+
Scenario: Set a configuration option from a file
|
20
|
+
Given a configuration file 'bobo.config'
|
21
|
+
When I load the configuration
|
22
|
+
Then config option 'foo' is 'bar'
|
23
|
+
And config option 'baz' is 'snarl'
|
File without changes
|
@@ -0,0 +1,48 @@
|
|
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
|
20
|
+
end
|
21
|
+
|
22
|
+
When /^I set '(.+)' to '(.+)'$/ do |key, value|
|
23
|
+
ConfigIt[key.to_sym] = value
|
24
|
+
end
|
25
|
+
|
26
|
+
Then /^config option '(.+)' is '(.+)'$/ do |key, value|
|
27
|
+
ConfigIt[key.to_sym].should == value
|
28
|
+
end
|
29
|
+
|
30
|
+
When /^I set '(.+)' to:$/ do |key, foo_table|
|
31
|
+
ConfigIt[key.to_sym] = Array.new
|
32
|
+
foo_table.hashes.each do |hash|
|
33
|
+
ConfigIt[key.to_sym] << hash['key']
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Then /^an array is returned for '(.+)'$/ do |key|
|
38
|
+
ConfigIt[key.to_sym].should be_a_kind_of(Array)
|
39
|
+
end
|
40
|
+
|
41
|
+
Given /^a configuration file '(.+)'$/ do |filename|
|
42
|
+
@config_file = File.join(File.dirname(__FILE__), "..", "support", filename)
|
43
|
+
end
|
44
|
+
|
45
|
+
When /^I load the configuration$/ do
|
46
|
+
ConfigIt.from_file(@config_file)
|
47
|
+
end
|
48
|
+
|
@@ -0,0 +1,24 @@
|
|
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
|
+
$: << File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
20
|
+
require 'mixlib/config'
|
21
|
+
|
22
|
+
class ConfigIt
|
23
|
+
extend Mixlib::Config
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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
|
+
$: << File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
20
|
+
|
21
|
+
require 'spec/expectations'
|
22
|
+
require 'mixlib/config'
|
23
|
+
require 'tmpdir'
|
24
|
+
require 'stringio'
|
25
|
+
|
26
|
+
class MyWorld
|
27
|
+
end
|
28
|
+
|
29
|
+
World do
|
30
|
+
MyWorld.new
|
31
|
+
end
|
data/lib/mixlib/config.rb
CHANGED
@@ -36,10 +36,10 @@ module Mixlib
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
# Pass Mixlib::Config.configure() a block, and it will yield
|
39
|
+
# Pass Mixlib::Config.configure() a block, and it will yield @@configuration.
|
40
40
|
#
|
41
41
|
# === Parameters
|
42
|
-
# <block>:: A block that
|
42
|
+
# <block>:: A block that is sent @@configuration as its argument
|
43
43
|
def configure(&block)
|
44
44
|
block.call(@@configuration)
|
45
45
|
end
|
@@ -142,18 +142,16 @@ module Mixlib
|
|
142
142
|
# <ArgumentError>:: If the method_symbol does not match a configuration option.
|
143
143
|
def method_missing(method_symbol, *args)
|
144
144
|
num_args = args.length
|
145
|
-
|
146
|
-
#
|
147
|
-
if
|
148
|
-
|
149
|
-
|
150
|
-
end
|
151
|
-
return @@configuration[method_symbol]
|
152
|
-
else
|
153
|
-
# Otherwise, we're just looking it up
|
154
|
-
raise ArgumentError, "Cannot find configuration option #{method_symbol.to_s}"
|
145
|
+
|
146
|
+
# Setting
|
147
|
+
if num_args > 0
|
148
|
+
method_symbol = $1.to_sym unless (method_symbol.to_s =~ /(.+)=$/).nil?
|
149
|
+
@@configuration[method_symbol] = (num_args == 1 ? args[0] : args)
|
155
150
|
end
|
156
|
-
|
151
|
+
|
152
|
+
# Returning
|
153
|
+
@@configuration[method_symbol]
|
157
154
|
|
155
|
+
end
|
158
156
|
end
|
159
157
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{mixlib-config}
|
5
|
+
s.version = "1.0.10"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Opscode, Inc."]
|
9
|
+
s.date = %q{2009-08-18}
|
10
|
+
s.email = %q{info@opscode.com}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"LICENSE",
|
13
|
+
"README.rdoc"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
".gitignore",
|
17
|
+
"LICENSE",
|
18
|
+
"NOTICE",
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION.yml",
|
22
|
+
"features/mixlib_config.feature",
|
23
|
+
"features/step_definitions/mixlib_config_steps.rb",
|
24
|
+
"features/steps/config_steps.rb",
|
25
|
+
"features/support/bobo.config",
|
26
|
+
"features/support/config_it.rb",
|
27
|
+
"features/support/env.rb",
|
28
|
+
"lib/mixlib/config.rb",
|
29
|
+
"mixlib-config.gemspec",
|
30
|
+
"spec/mixlib/config_spec.rb",
|
31
|
+
"spec/spec.opts",
|
32
|
+
"spec/spec_helper.rb"
|
33
|
+
]
|
34
|
+
s.homepage = %q{http://www.opscode.com}
|
35
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = %q{1.3.5}
|
38
|
+
s.summary = %q{A class based config mixin, similar to the one found in Chef.}
|
39
|
+
s.test_files = [
|
40
|
+
"spec/mixlib/config_spec.rb",
|
41
|
+
"spec/spec_helper.rb"
|
42
|
+
]
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
|
+
s.specification_version = 3
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
|
+
else
|
50
|
+
end
|
51
|
+
else
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opscode-mixlib-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Opscode, Inc.
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-18 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -23,16 +23,26 @@ extra_rdoc_files:
|
|
23
23
|
- LICENSE
|
24
24
|
- README.rdoc
|
25
25
|
files:
|
26
|
+
- .gitignore
|
26
27
|
- LICENSE
|
28
|
+
- NOTICE
|
27
29
|
- README.rdoc
|
28
30
|
- Rakefile
|
29
31
|
- VERSION.yml
|
32
|
+
- features/mixlib_config.feature
|
33
|
+
- features/step_definitions/mixlib_config_steps.rb
|
34
|
+
- features/steps/config_steps.rb
|
35
|
+
- features/support/bobo.config
|
36
|
+
- features/support/config_it.rb
|
37
|
+
- features/support/env.rb
|
30
38
|
- lib/mixlib/config.rb
|
39
|
+
- mixlib-config.gemspec
|
31
40
|
- spec/mixlib/config_spec.rb
|
32
41
|
- spec/spec.opts
|
33
42
|
- spec/spec_helper.rb
|
34
43
|
has_rdoc: false
|
35
44
|
homepage: http://www.opscode.com
|
45
|
+
licenses:
|
36
46
|
post_install_message:
|
37
47
|
rdoc_options:
|
38
48
|
- --charset=UTF-8
|
@@ -53,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
63
|
requirements: []
|
54
64
|
|
55
65
|
rubyforge_project:
|
56
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 1.3.5
|
57
67
|
signing_key:
|
58
68
|
specification_version: 3
|
59
69
|
summary: A class based config mixin, similar to the one found in Chef.
|