complex_config 0.9.2 → 0.10.0
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.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/VERSION +1 -1
- data/complex_config.gemspec +3 -3
- data/lib/complex_config/provider.rb +6 -0
- data/lib/complex_config/proxy.rb +25 -10
- data/lib/complex_config/version.rb +1 -1
- data/spec/complex_config/shortcuts_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c31636252c684eb2cc7795caec9d106839776b7
|
4
|
+
data.tar.gz: 2670fd9265acf9c09e9ee3d861c97c48693b8146
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e22fac36b063ddfda658354fb6876949a9fa5e9c87659fd9a2b46e709c3beb6fd9bf857334c9cbe372629dae6c9c4180ff05aa86e19ec4500ed4b301a8696a7
|
7
|
+
data.tar.gz: 9959e033efcccb41b2d110ae01633b4a1e602b7bdce44dc21a3a852005c0df9b5ea2f429cddb8ef28cd5c93e47632f8ff7b43b81f31f7009bfb545357ba7dd57
|
data/README.md
CHANGED
@@ -144,6 +144,8 @@ Here is the `ComplexConfig::Plugins::MONEY` plugin for example:
|
|
144
144
|
|
145
145
|
## Changes
|
146
146
|
|
147
|
+
* 2017-02-02 Release 0.10.0
|
148
|
+
* `cc.foo?`/`complex_config.foo?` returns config or nil (when not existant)
|
147
149
|
* 2017-01-23 Release 0.9.2
|
148
150
|
* Improve performance for proxy objects
|
149
151
|
* 2016-11-22 Release 0.9.1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.0
|
data/complex_config.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: complex_config 0.
|
2
|
+
# stub: complex_config 0.10.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "complex_config".freeze
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.10.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Florian Frank".freeze]
|
11
|
-
s.date = "2017-
|
11
|
+
s.date = "2017-02-02"
|
12
12
|
s.description = "This library allows you to access configuration files via a simple interface".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
14
|
s.extra_rdoc_files = ["README.md".freeze, "lib/complex_config.rb".freeze, "lib/complex_config/config.rb".freeze, "lib/complex_config/errors.rb".freeze, "lib/complex_config/plugins.rb".freeze, "lib/complex_config/plugins/enable.rb".freeze, "lib/complex_config/plugins/money.rb".freeze, "lib/complex_config/plugins/uri.rb".freeze, "lib/complex_config/provider.rb".freeze, "lib/complex_config/provider/shortcuts.rb".freeze, "lib/complex_config/proxy.rb".freeze, "lib/complex_config/railtie.rb".freeze, "lib/complex_config/rude.rb".freeze, "lib/complex_config/settings.rb".freeze, "lib/complex_config/shortcuts.rb".freeze, "lib/complex_config/version.rb".freeze]
|
data/lib/complex_config/proxy.rb
CHANGED
@@ -18,19 +18,34 @@ module ComplexConfig
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def method_missing(name, *args)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
if name =~ /\?\z/
|
22
|
+
method_name, name = name, $`
|
23
|
+
exist = ::ComplexConfig::Provider.exist?(name)
|
24
|
+
(class << self; self; end).class_eval do
|
25
|
+
define_method(method_name) do |env = nil|
|
26
|
+
if exist
|
27
|
+
__send__(name, *args)
|
28
|
+
else
|
29
|
+
nil
|
30
|
+
end
|
30
31
|
end
|
31
32
|
end
|
33
|
+
__send__(method_name, *args)
|
34
|
+
else
|
35
|
+
config = ::ComplexConfig::Provider[name]
|
36
|
+
(class << self; self; end).class_eval do
|
37
|
+
define_method(name) do |env = nil|
|
38
|
+
if env
|
39
|
+
config[env]
|
40
|
+
elsif @env
|
41
|
+
config[@env]
|
42
|
+
else
|
43
|
+
config
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
__send__(name, *args)
|
32
48
|
end
|
33
|
-
__send__(name, *args)
|
34
49
|
end
|
35
50
|
end
|
36
51
|
end
|
@@ -18,6 +18,11 @@ RSpec.describe 'shortcuts' do
|
|
18
18
|
expect(cc.config.name_prefix).to eq :config
|
19
19
|
end
|
20
20
|
|
21
|
+
it 'returns config or nil for ?-methods' do
|
22
|
+
expect(cc.config?).to eq cc.config
|
23
|
+
expect(cc.foo?).to be_nil
|
24
|
+
end
|
25
|
+
|
21
26
|
it 'can be reloaded via shortcut' do
|
22
27
|
expect(ComplexConfig::Provider).to receive(:flush_cache)
|
23
28
|
complex_config.reload
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: complex_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|