configurate 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.asc +8 -8
- data/README.md +194 -0
- data/lib/configurate/lookup_chain.rb +1 -1
- data/lib/configurate/provider/yaml.rb +9 -16
- data/lib/configurate/proxy.rb +21 -15
- data/lib/configurate/setting_path.rb +7 -6
- data/spec/configurate/lookup_chain_spec.rb +3 -3
- data/spec/configurate/provider/yaml_spec.rb +13 -4
- data/spec/configurate/proxy_spec.rb +3 -3
- data/spec/configurate/setting_path_spec.rb +11 -1
- data/spec/spec_helper.rb +7 -1
- metadata +21 -11
- metadata.gz.asc +8 -8
- checksums.yaml +0 -7
- checksums.yaml.gz.asc +0 -11
data.tar.gz.asc
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
-----BEGIN PGP SIGNATURE-----
|
2
|
-
Version: GnuPG v2.0.
|
2
|
+
Version: GnuPG v2.0.20 (GNU/Linux)
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
/
|
9
|
-
|
10
|
-
|
4
|
+
iQEcBAABAgAGBQJRrlMbAAoJEPNH4OtHrHDWnC0H/RMF7kn/MJ6sDIugAmWQXK43
|
5
|
+
BGyu3+oXLhDPkTOh090/xhajnDh2FqOFVgzdpJRTLkzffC5boy6gOw4c0FeOZJob
|
6
|
+
Vm0SiaBBv6qY9PNhUjjcvIH611oaAU/5WLqydCKPl49WKmhd4LGoH/iTnKWeVJWs
|
7
|
+
QPrYytfL7YDb8r0zAM/iQ39QI0Wtm+abPSY4zlBv5ZgkyRpbchYC7h7oetJYG9A1
|
8
|
+
C8MmoKBA2+aIrWomCcPWTcpuDTFV41Kyrrts7y/4KVc/bpnZo6t56mWmiFDtiMOi
|
9
|
+
WQ13Z49/2yMeLIQs5GW98ZS8r2EdkcW+ZzIJQuL7nPGmRqlRFgzs212qc/0gx/Y=
|
10
|
+
=+Q/C
|
11
11
|
-----END PGP SIGNATURE-----
|
data/README.md
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
# Configurate - A flexible configuration system
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/configurate.png)](https://rubygems.org/gems/configurate)
|
3
|
+
[![Build Status](https://secure.travis-ci.org/MrZYX/configurate.png?branch=master)](https://travis-ci.org/MrZYX/configurate)
|
4
|
+
[![Gemnasium](https://gemnasium.com/MrZYX/configurate.png)](https://gemnasium.com/MrZYX/configurate)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/MrZYX/configurate.png)](https://codeclimate.com/github/MrZYX/configurate)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/MrZYX/configurate/badge.png?branch=master)](https://coveralls.io/r/MrZYX/configurate)
|
7
|
+
|
8
|
+
Configurate allows you to specify a chain of configuration providers which are
|
9
|
+
queried in order until one returns a value. This allows scenarios like overriding
|
10
|
+
your default settings with a user configuration file and let those be overridden
|
11
|
+
by environment variables. The query interface allows to group and nest your configuration options
|
12
|
+
to a practically unlimited level.
|
13
|
+
|
14
|
+
Configurate works with Ruby 1.9.2 or later.
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Just add
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'configurate'
|
22
|
+
```
|
23
|
+
|
24
|
+
to your `Gemfile`.
|
25
|
+
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
A basic loader could look like this:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
require 'configurate'
|
33
|
+
|
34
|
+
Config = Configurate::Settings.create do
|
35
|
+
add_provider Configurate::Provider::Env
|
36
|
+
add_provider Configurate::Provider::YAML, '/etc/app_settings.yml',
|
37
|
+
namespace: Rails.env, required: false
|
38
|
+
add_provider Configurate::Provider::YAML, 'config/default_settings.yml'
|
39
|
+
end
|
40
|
+
|
41
|
+
# Somewhere later
|
42
|
+
if Config.remote_assets.enable?
|
43
|
+
set_asset_host Config.remote_assets.host
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
You can add custom methods working with your settings to your `Configurate::Settings` instance
|
48
|
+
by calling `extend YourConfigurationMethods` inside the block passed to `#create`.
|
49
|
+
|
50
|
+
Providers are called in the order they're added. You can already use the added providers to
|
51
|
+
determine if further ones should be added:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
require 'configurate'
|
55
|
+
|
56
|
+
Config = Configurate::Settings.create do
|
57
|
+
add_provider Configurate::Provider::Env
|
58
|
+
add_provider Configurate::Provider::YAML, 'config/settings.yml' unless heroku?
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
`add_provider` can be called later on the created object to add more providers to the chain.
|
63
|
+
It takes a constant and parameters that should be passed to the initializer.
|
64
|
+
|
65
|
+
A providers only requirement is that it responds to the `#lookup` method. `#lookup` is passed the current
|
66
|
+
`SettingPath`, for example for a call to `Config.foo.bar.baz?` it gets a path with the items `'foo'`, `'bar'`, `'baz'` passed. `SettingPath` behaves like `Array` with some methods added.
|
67
|
+
The provider should raise `Configurate::SettingNotFoundError` if it can't provide a value for the requested option.
|
68
|
+
Any additional parameters are passed along to the provider, thus a `#lookup` method must be able to take
|
69
|
+
any number of additional parameters.
|
70
|
+
|
71
|
+
You're not limited to one instance of the configuration object.
|
72
|
+
|
73
|
+
## Gotchas
|
74
|
+
|
75
|
+
### False
|
76
|
+
|
77
|
+
Ruby does not allow to metaprogram `false`, thus something like
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
puts "yep" if Config.enable_stuff
|
81
|
+
```
|
82
|
+
|
83
|
+
always outputs `yep`. The workaround is to append `.get` or `?` to get the
|
84
|
+
real value:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
puts "yep" if Config.enable_stuff?
|
88
|
+
```
|
89
|
+
|
90
|
+
### Module#===
|
91
|
+
|
92
|
+
Another thing you can't overwrite in Ruby is the `===` operator, rendering case statements useless
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
puts case Config.some.setting
|
96
|
+
when NilClass
|
97
|
+
"nil"
|
98
|
+
when String
|
99
|
+
"string"
|
100
|
+
else
|
101
|
+
"unknown"
|
102
|
+
end
|
103
|
+
```
|
104
|
+
|
105
|
+
will always output `unknown`. Again use `.get`
|
106
|
+
|
107
|
+
|
108
|
+
## Shipped providers
|
109
|
+
|
110
|
+
### Configurate::Provider::Base
|
111
|
+
|
112
|
+
A convenience base class changing the interface for implementers. It provides a basic `#lookup` method
|
113
|
+
which just passes all parameters through to `#lookup_path`.
|
114
|
+
The result of `#lookup_path` is returned, unless it's `nil`
|
115
|
+
then `Configurate::SettingNotFoundError` is raised. Subclasses are expected to implement `#lookup_path`.
|
116
|
+
Do not use this class directly as a provider!
|
117
|
+
|
118
|
+
### Configurate::Provider::Env
|
119
|
+
|
120
|
+
This class transforms a query string into a name for a environment variable and looks up this variable then.
|
121
|
+
The conversion scheme is the following: Convert to uppercase, join path with underscores. So for example `Config.foo.bar.baz`
|
122
|
+
would look for a environment variable named `FOO_BAR_BAZ`. Additionally it splits comma separated values
|
123
|
+
into arrays.
|
124
|
+
|
125
|
+
This provider does not take any additional initialization parameters.
|
126
|
+
|
127
|
+
### Configurate::Provider::YAML
|
128
|
+
|
129
|
+
This provider reads settings from a given [YAML](http://www.yaml.org) file. It converts the sections of
|
130
|
+
query string to a nested value. For a given YAML file
|
131
|
+
|
132
|
+
```yaml
|
133
|
+
stuff:
|
134
|
+
enable: true
|
135
|
+
param: "foo"
|
136
|
+
nested:
|
137
|
+
param: "bar"
|
138
|
+
```
|
139
|
+
|
140
|
+
the following queries would be valid:
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
Config.stuff.enable? # => true
|
144
|
+
Config.stuff.param # => "foo"
|
145
|
+
Config.stuff.nested.param # => "bar"
|
146
|
+
```
|
147
|
+
|
148
|
+
The initializer takes a path to the configuration file as mandatory first argument and
|
149
|
+
the following optional parameters, as a hash:
|
150
|
+
|
151
|
+
* *namespace:* Specify a alternative root. This is useful if you for example add the same file multiple
|
152
|
+
times through multiple providers, with different namespaces, letting you override settings depending on
|
153
|
+
the rails environment, without duplicating common settings. Defaults to none.
|
154
|
+
* *required:* Whether to raise an error if the the file isn't found or, if one is given, the namespace
|
155
|
+
doesn't exist in the file.
|
156
|
+
|
157
|
+
### Configurate::Provider::Dynamic
|
158
|
+
|
159
|
+
A provider which stores the first additonal parameter if the query string ends with an equal sign and can
|
160
|
+
return it later. This is mainly useful for testing but can be useful to temporarily overide stuff
|
161
|
+
too. To clarify a small example:
|
162
|
+
|
163
|
+
```ruby
|
164
|
+
Config.foo.bar # => nil
|
165
|
+
Config.foo.bar = "baz"
|
166
|
+
Config.foo.bar # => "baz"
|
167
|
+
```
|
168
|
+
|
169
|
+
## Writing a provider
|
170
|
+
|
171
|
+
...should be pretty easy. For example here is the `Configurate::Provider::Env` provider:
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
class Configurate::Provider::Env < Configurate::Provider::Base
|
175
|
+
def lookup_path(setting_path, *args)
|
176
|
+
value = ENV[setting_path.join("_").upcase]
|
177
|
+
unless value.nil?
|
178
|
+
value = value.dup
|
179
|
+
value = value.split(",") if value.include?(",")
|
180
|
+
end
|
181
|
+
value
|
182
|
+
end
|
183
|
+
end
|
184
|
+
```
|
185
|
+
|
186
|
+
|
187
|
+
## Documentation
|
188
|
+
|
189
|
+
You can find the current documentation for the master branch [here](http://rubydoc.info/github/MrZYX/configurate/master/frames/index).
|
190
|
+
|
191
|
+
|
192
|
+
## License
|
193
|
+
|
194
|
+
MIT, see [LICENSE](./LICENSE)
|
@@ -34,7 +34,7 @@ module Configurate
|
|
34
34
|
setting = SettingPath.new setting if setting.is_a? String
|
35
35
|
@provider.each do |provider|
|
36
36
|
begin
|
37
|
-
return special_value_or_string(provider.lookup(setting.
|
37
|
+
return special_value_or_string(provider.lookup(setting.clone, *args))
|
38
38
|
rescue SettingNotFoundError; end
|
39
39
|
end
|
40
40
|
|
@@ -19,13 +19,8 @@ module Configurate; module Provider
|
|
19
19
|
|
20
20
|
namespace = opts.delete(:namespace)
|
21
21
|
unless namespace.nil?
|
22
|
-
|
23
|
-
|
24
|
-
if !actual_settings.nil?
|
25
|
-
@settings = actual_settings
|
26
|
-
elsif required
|
27
|
-
raise ArgumentError, "Namespace #{namespace} not found in #{file}"
|
28
|
-
else
|
22
|
+
@settings = lookup_in_hash(SettingPath.new(namespace), @settings) do
|
23
|
+
raise ArgumentError, "Namespace #{namespace} not found in #{file}" if required
|
29
24
|
$stderr.puts "WARNING: Namespace #{namespace} not found in #{file}"
|
30
25
|
end
|
31
26
|
end
|
@@ -35,21 +30,19 @@ module Configurate; module Provider
|
|
35
30
|
end
|
36
31
|
|
37
32
|
|
38
|
-
def lookup_path(setting_path, *
|
33
|
+
def lookup_path(setting_path, *)
|
39
34
|
lookup_in_hash(setting_path, @settings)
|
40
35
|
end
|
41
36
|
|
42
37
|
private
|
43
38
|
|
44
|
-
def lookup_in_hash(setting_path, hash)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
return lookup_in_hash(setting_path, hash[setting]) if setting.length >= 1
|
49
|
-
else
|
50
|
-
return hash[setting]
|
51
|
-
end
|
39
|
+
def lookup_in_hash(setting_path, hash, &fallback)
|
40
|
+
fallback ||= proc { nil }
|
41
|
+
while hash.is_a?(Hash) && hash.has_key?(setting_path.first) && !setting_path.empty?
|
42
|
+
hash = hash[setting_path.shift]
|
52
43
|
end
|
44
|
+
return fallback.call unless setting_path.empty?
|
45
|
+
hash
|
53
46
|
end
|
54
47
|
end
|
55
48
|
end; end
|
data/lib/configurate/proxy.rb
CHANGED
@@ -14,7 +14,7 @@ module Configurate
|
|
14
14
|
# If a setting ends with +=+ it's too called directly, just like with +?+.
|
15
15
|
class Proxy < BasicObject
|
16
16
|
# @param lookup_chain [#lookup]
|
17
|
-
def initialize
|
17
|
+
def initialize lookup_chain
|
18
18
|
@lookup_chain = lookup_chain
|
19
19
|
@setting_path = SettingPath.new
|
20
20
|
end
|
@@ -23,28 +23,26 @@ module Configurate
|
|
23
23
|
!target
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def ==(other)
|
31
|
-
target == other
|
26
|
+
[:!=, :==, :eql?].each do |method|
|
27
|
+
define_method method do |other|
|
28
|
+
target.public_send method, target_or_object(other)
|
29
|
+
end
|
32
30
|
end
|
33
31
|
|
34
32
|
def _proxy?
|
35
33
|
true
|
36
34
|
end
|
37
35
|
|
38
|
-
def respond_to?
|
36
|
+
def respond_to? method, include_private=false
|
39
37
|
method == :_proxy? || target_respond_to?(method, include_private)
|
40
38
|
end
|
41
39
|
|
42
|
-
def send
|
40
|
+
def send *args, &block
|
43
41
|
__send__(*args, &block)
|
44
42
|
end
|
45
43
|
alias_method :public_send, :send
|
46
44
|
|
47
|
-
def method_missing
|
45
|
+
def method_missing setting, *args, &block
|
48
46
|
return target.public_send(setting, *args, &block) if target_respond_to? setting
|
49
47
|
|
50
48
|
@setting_path << setting
|
@@ -56,23 +54,31 @@ module Configurate
|
|
56
54
|
|
57
55
|
# Get the setting at the current path, if found.
|
58
56
|
# (see LookupChain#lookup)
|
59
|
-
def target
|
57
|
+
def target *args
|
60
58
|
return if @setting_path.empty?
|
61
59
|
|
62
|
-
@lookup_chain.lookup
|
60
|
+
@lookup_chain.lookup @setting_path, *args
|
63
61
|
end
|
64
62
|
alias_method :get, :target
|
65
63
|
|
66
64
|
private
|
67
65
|
COMMON_KEY_NAMES = [:key, :method]
|
68
66
|
|
69
|
-
def target_respond_to?
|
67
|
+
def target_respond_to? setting, include_private=false
|
70
68
|
return false if COMMON_KEY_NAMES.include? setting
|
71
69
|
|
72
70
|
value = target
|
73
|
-
return false if
|
71
|
+
return false if proxy? value
|
72
|
+
|
73
|
+
value.respond_to? setting, include_private
|
74
|
+
end
|
75
|
+
|
76
|
+
def proxy? obj
|
77
|
+
obj.respond_to?(:_proxy?) && obj._proxy?
|
78
|
+
end
|
74
79
|
|
75
|
-
|
80
|
+
def target_or_object obj
|
81
|
+
proxy?(obj) ? obj.target : obj
|
76
82
|
end
|
77
83
|
end
|
78
84
|
end
|
@@ -11,6 +11,11 @@ module Configurate
|
|
11
11
|
@path = path
|
12
12
|
end
|
13
13
|
|
14
|
+
def initialize_copy original
|
15
|
+
super
|
16
|
+
@path = @path.clone
|
17
|
+
end
|
18
|
+
|
14
19
|
def_delegators :@path, :empty?, :length, :size, :hsh
|
15
20
|
|
16
21
|
# Whether the current path looks like a question or setter method
|
@@ -35,7 +40,7 @@ module Configurate
|
|
35
40
|
end
|
36
41
|
end
|
37
42
|
|
38
|
-
[:join, :last, :shift, :pop].each do |method|
|
43
|
+
[:join, :first, :last, :shift, :pop].each do |method|
|
39
44
|
define_method method do |*args|
|
40
45
|
clean_special_characters @path.public_send(method, *args)
|
41
46
|
end
|
@@ -51,10 +56,6 @@ module Configurate
|
|
51
56
|
join(".")
|
52
57
|
end
|
53
58
|
|
54
|
-
def dup
|
55
|
-
SettingPath.new(@path.dup)
|
56
|
-
end
|
57
|
-
|
58
59
|
def ==(other)
|
59
60
|
to_s == other.to_s
|
60
61
|
end
|
@@ -65,7 +66,7 @@ module Configurate
|
|
65
66
|
|
66
67
|
private
|
67
68
|
|
68
|
-
def clean_special_characters
|
69
|
+
def clean_special_characters value
|
69
70
|
value.to_s.chomp("?").chomp("=")
|
70
71
|
end
|
71
72
|
end
|
@@ -36,7 +36,7 @@ describe Configurate::LookupChain do
|
|
36
36
|
|
37
37
|
it "it tries all providers" do
|
38
38
|
setting = Configurate::SettingPath.new "some.setting"
|
39
|
-
setting.stub(:
|
39
|
+
setting.stub(:clone).and_return(setting)
|
40
40
|
@provider.each do |provider|
|
41
41
|
provider.should_receive(:lookup).with(setting).and_raise(Configurate::SettingNotFoundError)
|
42
42
|
end
|
@@ -47,7 +47,7 @@ describe Configurate::LookupChain do
|
|
47
47
|
it "converts a string to a SettingPath" do
|
48
48
|
provider = @provider.first
|
49
49
|
path = stub
|
50
|
-
path.stub(:
|
50
|
+
path.stub(:clone).and_return(path)
|
51
51
|
provider.should_receive(:lookup).with(path).and_raise(Configurate::SettingNotFoundError)
|
52
52
|
setting = "bar"
|
53
53
|
Configurate::SettingPath.should_receive(:new).with(setting).and_return(path)
|
@@ -58,7 +58,7 @@ describe Configurate::LookupChain do
|
|
58
58
|
provider = @provider.first
|
59
59
|
path = mock("path")
|
60
60
|
copy = stub("copy")
|
61
|
-
path.should_receive(:
|
61
|
+
path.should_receive(:clone).at_least(:once).and_return(copy)
|
62
62
|
provider.should_receive(:lookup).with(copy).and_raise(Configurate::SettingNotFoundError)
|
63
63
|
subject.lookup(path)
|
64
64
|
end
|
@@ -17,25 +17,34 @@ describe Configurate::Provider::YAML do
|
|
17
17
|
it "raises if the file is not found" do
|
18
18
|
::YAML.stub(:load_file).and_raise(Errno::ENOENT)
|
19
19
|
expect {
|
20
|
-
|
20
|
+
silence_stderr do
|
21
|
+
described_class.new "foo"
|
22
|
+
end
|
21
23
|
}.to raise_error Errno::ENOENT
|
22
24
|
end
|
23
25
|
|
24
26
|
|
25
27
|
context "with a namespace" do
|
26
28
|
it "looks in the file for that namespace" do
|
27
|
-
namespace = "some"
|
29
|
+
namespace = "some.nested"
|
28
30
|
::YAML.stub(:load_file).and_return(settings)
|
29
31
|
provider = described_class.new 'bla', namespace: namespace
|
30
|
-
provider.instance_variable_get(:@settings).should == settings[
|
32
|
+
provider.instance_variable_get(:@settings).should == settings['some']['nested']
|
31
33
|
end
|
32
34
|
|
33
35
|
it "raises if the namespace isn't found" do
|
34
36
|
::YAML.stub(:load_file).and_return({})
|
35
37
|
expect {
|
36
|
-
described_class.new 'bla', namespace: "
|
38
|
+
described_class.new 'bla', namespace: "bar"
|
37
39
|
}.to raise_error ArgumentError
|
38
40
|
end
|
41
|
+
|
42
|
+
it "works with an empty namespace in the file" do
|
43
|
+
::YAML.stub(:load_file).and_return({'foo' => {'bar' => nil}})
|
44
|
+
expect {
|
45
|
+
described_class.new 'bla', namespace: "foo.bar"
|
46
|
+
}.to_not raise_error ArgumentError
|
47
|
+
end
|
39
48
|
end
|
40
49
|
|
41
50
|
context "with required set to false" do
|
@@ -37,8 +37,8 @@ describe Configurate::Proxy do
|
|
37
37
|
proxy.something.__send__(:!)
|
38
38
|
end
|
39
39
|
|
40
|
-
it "
|
41
|
-
proxy.should_receive(:
|
40
|
+
it "enables sends even though be BasicObject" do
|
41
|
+
proxy.should_receive(:foo)
|
42
42
|
proxy.send(:foo)
|
43
43
|
end
|
44
44
|
end
|
@@ -49,7 +49,7 @@ describe Configurate::Proxy do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "#target" do
|
52
|
-
[:to_str, :to_s, :to_xml, :respond_to?, :present?, :!=,
|
52
|
+
[:to_str, :to_s, :to_xml, :respond_to?, :present?, :!=, :eql?,
|
53
53
|
:each, :try, :size, :length, :count, :==, :=~, :gsub, :blank?, :chop,
|
54
54
|
:start_with?, :end_with?].each do |method|
|
55
55
|
it "is called for accessing #{method} on the proxy" do
|
@@ -38,6 +38,16 @@ describe Configurate::SettingPath do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
describe "#initialize_copy" do
|
42
|
+
it "modifying a copy leaves the original unchanged" do
|
43
|
+
original = described_class.new ["foo", "bar"]
|
44
|
+
copy = original.clone
|
45
|
+
copy << "baz"
|
46
|
+
copy.should include "baz"
|
47
|
+
original.should_not include "baz"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
41
51
|
|
42
52
|
describe "#is_question_or_setter?" do
|
43
53
|
context "with a question signature as setting" do
|
@@ -62,7 +72,7 @@ describe Configurate::SettingPath do
|
|
62
72
|
end
|
63
73
|
end
|
64
74
|
|
65
|
-
[:join, :last, :shift, :pop].each do |method|
|
75
|
+
[:join, :first, :last, :shift, :pop].each do |method|
|
66
76
|
describe "##{method}" do
|
67
77
|
subject { question_path.public_send method }
|
68
78
|
it { should_not include "?" }
|
data/spec/spec_helper.rb
CHANGED
@@ -9,10 +9,16 @@
|
|
9
9
|
begin
|
10
10
|
require 'coveralls'
|
11
11
|
Coveralls.wear!
|
12
|
-
rescue; end
|
12
|
+
rescue LoadError; end
|
13
13
|
|
14
14
|
require 'configurate'
|
15
15
|
|
16
|
+
def silence_stderr
|
17
|
+
$stderr = StringIO.new
|
18
|
+
yield
|
19
|
+
$stderr = STDERR
|
20
|
+
end
|
21
|
+
|
16
22
|
RSpec.configure do |config|
|
17
23
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
18
24
|
config.run_all_when_everything_filtered = true
|
metadata
CHANGED
@@ -1,41 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configurate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Jonne Haß
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
+
date: 2013-06-04 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rake
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 10.0.3
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 10.0.3
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rspec
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: 2.12.0
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: 2.12.0
|
41
46
|
description: Configurate is a flexible configuration system that can read settings
|
@@ -53,6 +58,7 @@ files:
|
|
53
58
|
- lib/configurate/provider.rb
|
54
59
|
- lib/configurate/setting_path.rb
|
55
60
|
- lib/configurate.rb
|
61
|
+
- README.md
|
56
62
|
- spec/configurate/provider_spec.rb
|
57
63
|
- spec/configurate/lookup_chain_spec.rb
|
58
64
|
- spec/configurate/provider/yaml_spec.rb
|
@@ -65,26 +71,30 @@ files:
|
|
65
71
|
homepage: http://mrzyx.github.com/configurate
|
66
72
|
licenses:
|
67
73
|
- MIT
|
68
|
-
metadata: {}
|
69
74
|
post_install_message:
|
70
75
|
rdoc_options: []
|
71
76
|
require_paths:
|
72
77
|
- lib
|
73
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
74
80
|
requirements:
|
75
|
-
- - '>='
|
81
|
+
- - ! '>='
|
76
82
|
- !ruby/object:Gem::Version
|
77
83
|
version: 1.9.2
|
78
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
79
86
|
requirements:
|
80
|
-
- - '>='
|
87
|
+
- - ! '>='
|
81
88
|
- !ruby/object:Gem::Version
|
82
89
|
version: '0'
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
hash: 61337675234892431
|
83
93
|
requirements: []
|
84
94
|
rubyforge_project:
|
85
|
-
rubygems_version:
|
95
|
+
rubygems_version: 1.8.25
|
86
96
|
signing_key:
|
87
|
-
specification_version:
|
97
|
+
specification_version: 3
|
88
98
|
summary: Flexbile configuration system
|
89
99
|
test_files:
|
90
100
|
- spec/configurate/provider_spec.rb
|
metadata.gz.asc
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
-----BEGIN PGP SIGNATURE-----
|
2
|
-
Version: GnuPG v2.0.
|
2
|
+
Version: GnuPG v2.0.20 (GNU/Linux)
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
=
|
4
|
+
iQEcBAABAgAGBQJRrlMbAAoJEPNH4OtHrHDWzAQH/jluldbgxLrHmdrfNGxDOfuy
|
5
|
+
frt0ZFgpUBkySAh6D16fJeDOu1ziPao8wHM+G4WpvC+szE0kgPoAQV68ON2x4zCL
|
6
|
+
FkidnZ0sKHe1z3VKWtl181Du+qbkdz8AhAigTtZPWd2BqR7wniKgvR5j31d553SX
|
7
|
+
bQI9ojwOwbOjREmQ795wn/xILE8jkh2tOu+GuMR6TTqY2xXOz3Ccjl+muCDPmnW2
|
8
|
+
lQzwodaCVweEzR2AZrkK+MNI5Wq8Ox56RYh1DfHr7nk0jRDCnlSKBl0++EdV3Ies
|
9
|
+
eZ2gJBtPGRWk/bumqjaz60QS7m9BwUnq+HqkIQzrxlX/IeVY8cjZG8wyDkWwgxg=
|
10
|
+
=vOi8
|
11
11
|
-----END PGP SIGNATURE-----
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 62064f50888eaee9e0dd71a18ee00cb28b9702ab
|
4
|
-
data.tar.gz: 78fc9f09be5f3ebbf160c00b8876ebdca816bbb2
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: a398197b08cae2c689bbf70b547dba1b820b614afa438e649060110f3fb830ea7df2f560add336896a409aad166c7209d57c6fbae749036f045bd6c013478ffb
|
7
|
-
data.tar.gz: 98ed0b719702cb09d7df4c2ea5c785d244d6eb83e41b6c9460a2b651df6bb445ab54923765518fa8a179bc134929c25a1ad3edc5c753b24fd5d38842f80db97e
|
checksums.yaml.gz.asc
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
-----BEGIN PGP SIGNATURE-----
|
2
|
-
Version: GnuPG v2.0.19 (GNU/Linux)
|
3
|
-
|
4
|
-
iQEcBAABAgAGBQJRg4ugAAoJEPNH4OtHrHDWjlAH/2VlTkOoe6kHg+vno9/EWm6c
|
5
|
-
UCYP4vs2P+SFjmlNVlm37I8wNMriEWsJFjDPxz3LbUZB9ZhHQps4EkfqfCnDUJKR
|
6
|
-
rkuB/+B1UW1Kmomkosnh4dLtHqh50F0NDmxGQOq7fq5srNwsqOWMvvWaSs1IPQgM
|
7
|
-
eaENgLaEJ4j77Ilu3OZ47q+faBusJOkY8YhBI7QjcELpkVStdnFmqCznrOCWo0H5
|
8
|
-
TmeHmCdScpIdBTgkNynt4FN8VFld+0fTdK9hoNQlsmoB9nDFuAsI9FH8zIpPmC6a
|
9
|
-
RY2BupAL9UT3H302sIo5k233HG2h2NhbB3YDvi2I6lMGgo4UPT4N9l01h0Ey+eA=
|
10
|
-
=mUKJ
|
11
|
-
-----END PGP SIGNATURE-----
|