complex_config 0.5.0 → 0.5.2
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/.travis.yml +4 -0
- data/README.md +7 -4
- data/TODO.md +0 -1
- data/VERSION +1 -1
- data/complex_config.gemspec +7 -7
- data/lib/complex_config/settings.rb +12 -0
- data/lib/complex_config/version.rb +1 -1
- data/spec/complex_config/plugins_spec.rb +4 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36794c1042e1468dd3727dde06787dc09eedace7
|
4
|
+
data.tar.gz: 256eeab2a1bb70476216f07582f664813a935cbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c1ec259c62a0f77b8b37533766fe39ad9a4d9d524bb4774aefd93328c2de753b2900fcc3326d2d1f5a6ff97ec6470638cc6848027287ad6b8b09ab81eae542b
|
7
|
+
data.tar.gz: 2e7c6dec04e9151c529ddff832e262d849abc44d95d4ae7a4ef3d90c1d728abff7b48bd339cd37122ac99bce1dd01a1476c210fe48b9cbae3df664c8930a6786
|
data/.travis.yml
CHANGED
@@ -2,11 +2,15 @@ rvm:
|
|
2
2
|
- 2.0
|
3
3
|
- 2.1
|
4
4
|
- 2.2
|
5
|
+
- 2.3.1
|
6
|
+
- 2.4.0-preview1
|
5
7
|
- ruby-head
|
6
8
|
- jruby-head
|
9
|
+
sudo: false
|
7
10
|
matrix:
|
8
11
|
allow_failures:
|
9
12
|
- rvm: ruby-head
|
10
13
|
- rvm: jruby-head
|
14
|
+
- rvm: 2.4.0-preview1
|
11
15
|
env:
|
12
16
|
- RAILS_ENV=development CODECLIMATE_REPO_TOKEN=b2d573b4ad139331f307e536679084a8ec269d721e31b0afe81c503a7ab0c683
|
data/README.md
CHANGED
@@ -60,21 +60,21 @@ use `cc(:products).flux_capacitor…` to avoid this problem.
|
|
60
60
|
|
61
61
|
Fetching the price of a product in cents:
|
62
62
|
|
63
|
-
>
|
63
|
+
> cc.products.flux_capacitor.enterprise_version.price_in_cents => 160000000
|
64
64
|
|
65
65
|
Fetching the price of a product and using the ComplexConfig::Plugins::MONEY
|
66
66
|
plugin to format it:
|
67
67
|
|
68
|
-
>
|
68
|
+
> cc.products.flux_capacitor.enterprise_version.price.format => "€1,600,000.00"
|
69
69
|
|
70
70
|
Fetching the URL of a product manual as a string:
|
71
71
|
|
72
|
-
>
|
72
|
+
> cc.products.flux_capacitor.enterprise_version.manual_pdf_url => "http://brown-inc.com/manuals/fc_enterprise.pdf"
|
73
73
|
|
74
74
|
Fetching the URL of a product manual and using the ComplexConfig::Plugins::URI
|
75
75
|
plugin return an URI instance:
|
76
76
|
|
77
|
-
>
|
77
|
+
> cc.products.flux_capacitor.enterprise_version.manual_pdf_uri => #<URI::HTTP:0x007ff626d2a2e8 URL:http://brown-inc.com/manuals/fc_enterprise.pdf>
|
78
78
|
|
79
79
|
You can also fetch config settings from a different environment:
|
80
80
|
|
@@ -143,6 +143,9 @@ Here is the `ComplexConfig::Plugins::MONEY` plugin for example:
|
|
143
143
|
end
|
144
144
|
|
145
145
|
## Changes
|
146
|
+
* 2016-06-23 Release 0.5.2
|
147
|
+
* Resolve index access via the plugin code path, so foo.bar and foo[:bar]
|
148
|
+
have the same result for a plugin key.
|
146
149
|
* 2015-11-19 Release 0.5.0
|
147
150
|
* Support rails reloading behaviour.
|
148
151
|
* Allow configuration via ComplexConfig.configure(&block) method.
|
data/TODO.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/complex_config.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: complex_config 0.5.
|
2
|
+
# stub: complex_config 0.5.2 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "complex_config"
|
6
|
-
s.version = "0.5.
|
6
|
+
s.version = "0.5.2"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Florian Frank"]
|
11
|
-
s.date = "
|
11
|
+
s.date = "2016-06-23"
|
12
12
|
s.description = "This library allows you to access configuration files via a simple interface"
|
13
13
|
s.email = "flori@ping.de"
|
14
14
|
s.extra_rdoc_files = ["README.md", "lib/complex_config.rb", "lib/complex_config/config.rb", "lib/complex_config/errors.rb", "lib/complex_config/plugins.rb", "lib/complex_config/plugins/enable.rb", "lib/complex_config/plugins/money.rb", "lib/complex_config/plugins/uri.rb", "lib/complex_config/provider.rb", "lib/complex_config/proxy.rb", "lib/complex_config/railtie.rb", "lib/complex_config/rude.rb", "lib/complex_config/settings.rb", "lib/complex_config/shortcuts.rb", "lib/complex_config/version.rb"]
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.homepage = "https://github.com/flori/complex_config"
|
17
17
|
s.licenses = ["Apache-2.0"]
|
18
18
|
s.rdoc_options = ["--title", "ComplexConfig -- configuration library", "--main", "README.md"]
|
19
|
-
s.rubygems_version = "2.5.
|
19
|
+
s.rubygems_version = "2.5.1"
|
20
20
|
s.summary = "configuration library"
|
21
21
|
s.test_files = ["spec/complex_config/config_spec.rb", "spec/complex_config/plugins_spec.rb", "spec/complex_config/provider_spec.rb", "spec/complex_config/settings_spec.rb", "spec/complex_config/shortcuts_spec.rb", "spec/spec_helper.rb"]
|
22
22
|
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.specification_version = 4
|
25
25
|
|
26
26
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
-
s.add_development_dependency(%q<gem_hadar>, ["~> 1.
|
27
|
+
s.add_development_dependency(%q<gem_hadar>, ["~> 1.7.1"])
|
28
28
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
29
29
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
30
30
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
34
34
|
s.add_runtime_dependency(%q<tins>, [">= 0"])
|
35
35
|
else
|
36
|
-
s.add_dependency(%q<gem_hadar>, ["~> 1.
|
36
|
+
s.add_dependency(%q<gem_hadar>, ["~> 1.7.1"])
|
37
37
|
s.add_dependency(%q<rake>, [">= 0"])
|
38
38
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
39
39
|
s.add_dependency(%q<rspec>, [">= 0"])
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
|
|
43
43
|
s.add_dependency(%q<tins>, [">= 0"])
|
44
44
|
end
|
45
45
|
else
|
46
|
-
s.add_dependency(%q<gem_hadar>, ["~> 1.
|
46
|
+
s.add_dependency(%q<gem_hadar>, ["~> 1.7.1"])
|
47
47
|
s.add_dependency(%q<rake>, [">= 0"])
|
48
48
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
49
49
|
s.add_dependency(%q<rspec>, [">= 0"])
|
@@ -104,6 +104,18 @@ class ComplexConfig::Settings < JSON::GenericObject
|
|
104
104
|
freeze
|
105
105
|
end
|
106
106
|
|
107
|
+
alias index []
|
108
|
+
|
109
|
+
def [](name)
|
110
|
+
if !attribute_set?(name) and
|
111
|
+
value = ComplexConfig::Provider.apply_plugins(self, name)
|
112
|
+
then
|
113
|
+
value
|
114
|
+
else
|
115
|
+
index(name)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
107
119
|
private
|
108
120
|
|
109
121
|
def table_enumerator
|
@@ -24,6 +24,10 @@ RSpec.describe ComplexConfig::Settings do
|
|
24
24
|
expect(settings.foo.test_uri).to eq URI.parse('http://www.ping.de')
|
25
25
|
end
|
26
26
|
|
27
|
+
it 'can return an URI' do
|
28
|
+
expect(settings.foo[:test_uri]).to eq URI.parse('http://www.ping.de')
|
29
|
+
end
|
30
|
+
|
27
31
|
it 'can skips if blub' do
|
28
32
|
expect { settings.foo.nix_uri }.to raise_error(ComplexConfig::AttributeMissing)
|
29
33
|
end
|
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.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.7.1
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.7.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
requirements: []
|
203
203
|
rubyforge_project:
|
204
|
-
rubygems_version: 2.5.
|
204
|
+
rubygems_version: 2.5.1
|
205
205
|
signing_key:
|
206
206
|
specification_version: 4
|
207
207
|
summary: configuration library
|