opscode-mixlib-config 1.0.10 → 1.0.11
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/VERSION.yml +1 -1
- data/lib/mixlib/config.rb +1 -5
- data/spec/mixlib/config_spec.rb +9 -2
- metadata +2 -11
- data/.gitignore +0 -5
- data/NOTICE +0 -27
- data/features/mixlib_config.feature +0 -23
- data/features/step_definitions/mixlib_config_steps.rb +0 -0
- data/features/steps/config_steps.rb +0 -48
- data/features/support/bobo.config +0 -3
- data/features/support/config_it.rb +0 -24
- data/features/support/env.rb +0 -31
- data/mixlib-config.gemspec +0 -53
data/VERSION.yml
CHANGED
data/lib/mixlib/config.rb
CHANGED
@@ -29,11 +29,7 @@ module Mixlib
|
|
29
29
|
# === Parameters
|
30
30
|
# <string>:: A filename to read from
|
31
31
|
def from_file(filename)
|
32
|
-
|
33
|
-
self.instance_eval(IO.read(filename), filename, 1)
|
34
|
-
rescue Exception => e
|
35
|
-
raise IOError, "Cannot open or read #{filename}!" + e
|
36
|
-
end
|
32
|
+
self.instance_eval(IO.read(filename), filename, 1)
|
37
33
|
end
|
38
34
|
|
39
35
|
# Pass Mixlib::Config.configure() a block, and it will yield @@configuration.
|
data/spec/mixlib/config_spec.rb
CHANGED
@@ -41,10 +41,17 @@ describe Mixlib::Config do
|
|
41
41
|
}.should_not raise_error(ArgumentError)
|
42
42
|
end
|
43
43
|
|
44
|
-
it "should raise an
|
44
|
+
it "should raise an Errno::ENOENT if it can't find the file" do
|
45
45
|
lambda {
|
46
46
|
ConfigIt.from_file("/tmp/timmytimmytimmy")
|
47
|
-
}.should raise_error(
|
47
|
+
}.should raise_error(Errno::ENOENT)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should allow the error to bubble up when it's anything other than IOError" do
|
51
|
+
IO.stub!(:read).with('config.rb').and_return("@#asdf")
|
52
|
+
lambda {
|
53
|
+
ConfigIt.from_file('config.rb')
|
54
|
+
}.should raise_error(SyntaxError)
|
48
55
|
end
|
49
56
|
|
50
57
|
it "should allow you to reference a value by index" do
|
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.11
|
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-08-
|
12
|
+
date: 2009-08-24 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -23,20 +23,11 @@ extra_rdoc_files:
|
|
23
23
|
- LICENSE
|
24
24
|
- README.rdoc
|
25
25
|
files:
|
26
|
-
- .gitignore
|
27
26
|
- LICENSE
|
28
|
-
- NOTICE
|
29
27
|
- README.rdoc
|
30
28
|
- Rakefile
|
31
29
|
- 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
|
38
30
|
- lib/mixlib/config.rb
|
39
|
-
- mixlib-config.gemspec
|
40
31
|
- spec/mixlib/config_spec.rb
|
41
32
|
- spec/spec.opts
|
42
33
|
- spec/spec_helper.rb
|
data/NOTICE
DELETED
@@ -1,27 +0,0 @@
|
|
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.
|
@@ -1,23 +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
|
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
|
@@ -1,48 +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
|
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
|
-
|
@@ -1,24 +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
|
-
$: << File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
20
|
-
require 'mixlib/config'
|
21
|
-
|
22
|
-
class ConfigIt
|
23
|
-
extend Mixlib::Config
|
24
|
-
end
|
data/features/support/env.rb
DELETED
@@ -1,31 +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
|
-
$: << 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/mixlib-config.gemspec
DELETED
@@ -1,53 +0,0 @@
|
|
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
|