configatron 4.0.3 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +13 -0
- data/README.md +1 -1
- data/lib/configatron.rb +1 -0
- data/lib/configatron/integrations.rb +1 -4
- data/lib/configatron/integrations/rails.rb +1 -1
- data/lib/configatron/root_store.rb +2 -1
- data/lib/configatron/store.rb +7 -3
- data/lib/configatron/version.rb +1 -1
- data/test/functional/configatron.rb +10 -0
- data/test/functional/minitest.rb +18 -0
- metadata +5 -3
data/History.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
=== 4.1.0
|
2
|
+
|
3
|
+
* Fix bugs from BasicObject fallout
|
4
|
+
* Have KernelStore proxy calls using `public_send` for consistent shadowing
|
5
|
+
|
6
|
+
=== 4.0.3
|
7
|
+
|
8
|
+
* Switch Store and RootStore to descend from BasicObject
|
9
|
+
|
10
|
+
=== 4.0.2
|
11
|
+
|
12
|
+
* Add missing require of Rails integration
|
13
|
+
|
1
14
|
=== 4.0.1
|
2
15
|
|
3
16
|
* Fix #inspect and #to_s methods on KernelStore to pass through to Store
|
data/README.md
CHANGED
@@ -78,7 +78,7 @@ configatron.email.pop.port # => 110
|
|
78
78
|
|
79
79
|
### Method vs hash access
|
80
80
|
|
81
|
-
As a note, method (`configatron.foo`) access will be shadowed by methods defined on the configatron object. (The configatron object descends from [`BasicObject`](http://apidock.com/ruby/BasicObject) and includes `Kernel`, so it should have a pretty bare set of methods.)
|
81
|
+
As a note, method (`configatron.foo`) access will be shadowed by public methods defined on the configatron object. (The configatron object descends from [`BasicObject`](http://apidock.com/ruby/BasicObject) and includes `Kernel`, so it should have a pretty bare set of methods.)
|
82
82
|
|
83
83
|
If you need to use keys that are themselves method names, you can just use hash access (`configatron['foo']`).
|
84
84
|
|
data/lib/configatron.rb
CHANGED
@@ -3,6 +3,7 @@ require 'singleton'
|
|
3
3
|
# This is the root configatron object, and contains methods which
|
4
4
|
# operate on the entire configatron hierarchy.
|
5
5
|
class Configatron::RootStore < BasicObject
|
6
|
+
include ::Kernel
|
6
7
|
include ::Singleton
|
7
8
|
extend ::Forwardable
|
8
9
|
|
@@ -20,7 +21,7 @@ class Configatron::RootStore < BasicObject
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def method_missing(name, *args, &block)
|
23
|
-
store.
|
24
|
+
store.public_send(name, *args, &block)
|
24
25
|
end
|
25
26
|
|
26
27
|
def reset!
|
data/lib/configatron/store.rb
CHANGED
@@ -5,11 +5,10 @@ class Configatron
|
|
5
5
|
include ::Kernel
|
6
6
|
extend ::Forwardable
|
7
7
|
|
8
|
-
def initialize(root_store, name='configatron')
|
8
|
+
def initialize(root_store, name='configatron', attributes={})
|
9
9
|
@root_store = root_store
|
10
10
|
@name = name
|
11
|
-
|
12
|
-
@attributes = {}
|
11
|
+
@attributes = attributes
|
13
12
|
end
|
14
13
|
|
15
14
|
def [](key)
|
@@ -102,6 +101,11 @@ class Configatron
|
|
102
101
|
@method_missing = false
|
103
102
|
end
|
104
103
|
|
104
|
+
# Needed for deep_clone to actually clone this object
|
105
|
+
def clone
|
106
|
+
self.class.new(@root_store, @name, @attributes)
|
107
|
+
end
|
108
|
+
|
105
109
|
private
|
106
110
|
|
107
111
|
def do_lookup(name, *args, &block)
|
data/lib/configatron/version.rb
CHANGED
@@ -80,4 +80,14 @@ class Critic::Functional::ConfigatronTest < Critic::Functional::Test
|
|
80
80
|
puts @kernel.hi
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
describe 'private methods on kernel' do
|
85
|
+
it 'can be accessed through method accessors' do
|
86
|
+
@kernel.catch = 'hi'
|
87
|
+
@kernel.foo.catch = 'hi'
|
88
|
+
|
89
|
+
assert_equal('hi', @kernel.catch)
|
90
|
+
assert_equal('hi', @kernel.foo.catch)
|
91
|
+
end
|
92
|
+
end
|
83
93
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative '_lib'
|
2
|
+
require 'subprocess'
|
3
|
+
|
4
|
+
class Critic::Functional::MinitestTest < Critic::Functional::Test
|
5
|
+
include Configatron::Integrations::Minitest
|
6
|
+
|
7
|
+
describe 'multiple runs' do
|
8
|
+
it 'settings get reset: 1' do
|
9
|
+
assert(!configatron.key?(:my_crazy_setting))
|
10
|
+
configatron.my_crazy_setting = true
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'settings get reset: 2' do
|
14
|
+
assert(!configatron.key?(:my_crazy_setting))
|
15
|
+
configatron.my_crazy_setting = true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configatron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- test/functional/_lib/scripts/core.rb
|
118
118
|
- test/functional/configatron.rb
|
119
119
|
- test/functional/loading.rb
|
120
|
+
- test/functional/minitest.rb
|
120
121
|
- test/unit/_lib.rb
|
121
122
|
- test/unit/configatron/proc.rb
|
122
123
|
- test/unit/configatron/root_store.rb
|
@@ -136,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
137
|
version: '0'
|
137
138
|
segments:
|
138
139
|
- 0
|
139
|
-
hash:
|
140
|
+
hash: 201983176826574058
|
140
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
142
|
none: false
|
142
143
|
requirements:
|
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
146
|
version: '0'
|
146
147
|
segments:
|
147
148
|
- 0
|
148
|
-
hash:
|
149
|
+
hash: 201983176826574058
|
149
150
|
requirements: []
|
150
151
|
rubyforge_project:
|
151
152
|
rubygems_version: 1.8.25
|
@@ -158,6 +159,7 @@ test_files:
|
|
158
159
|
- test/functional/_lib/scripts/core.rb
|
159
160
|
- test/functional/configatron.rb
|
160
161
|
- test/functional/loading.rb
|
162
|
+
- test/functional/minitest.rb
|
161
163
|
- test/unit/_lib.rb
|
162
164
|
- test/unit/configatron/proc.rb
|
163
165
|
- test/unit/configatron/root_store.rb
|