complex_config 0.17.1 → 0.19.1
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/.tool-versions +1 -0
- data/.travis.yml +2 -0
- data/VERSION +1 -1
- data/complex_config.gemspec +15 -24
- data/lib/complex_config/plugins/uri.rb +1 -1
- data/lib/complex_config/provider.rb +16 -6
- data/lib/complex_config/settings.rb +13 -3
- data/lib/complex_config/version.rb +1 -1
- data/spec/complex_config/settings_spec.rb +5 -0
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe5832112e279c1bdadad2c91d5ba3c6872dbbead84955e46afb93ed317ea254
|
|
4
|
+
data.tar.gz: f71125155654cec752772eed831ec0224f35a4a164c8bb98bbd1c9ce44c2969e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ed5d657e1335598d5794412dc9a802a5e2c99be3c53d36d788d969bdc84c14bb69bb7cea1e933d05fd090c93eb061eb6c8a779db0d4e29212cc59345d7a69f7c
|
|
7
|
+
data.tar.gz: c1e88b402088da14ac41850160a05651a9f59618199dc886fe932e579b4052eab48f05fa0d241600616d395a117732a6a46598e2ea475e2b965b04b20837b5e2
|
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 3.0.1
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.19.1
|
data/complex_config.gemspec
CHANGED
|
@@ -1,48 +1,39 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: complex_config 0.
|
|
2
|
+
# stub: complex_config 0.19.1 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.19.1"
|
|
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 = "
|
|
11
|
+
s.date = "2021-04-09"
|
|
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.executables = ["complex_config".freeze]
|
|
15
15
|
s.extra_rdoc_files = ["README.md".freeze, "lib/complex_config.rb".freeze, "lib/complex_config/config.rb".freeze, "lib/complex_config/encryption.rb".freeze, "lib/complex_config/errors.rb".freeze, "lib/complex_config/key_source.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]
|
|
16
|
-
s.files = [".gitignore".freeze, ".rspec".freeze, ".travis.yml".freeze, ".utilsrc".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/complex_config".freeze, "complex_config.gemspec".freeze, "config/products.yml".freeze, "lib/complex_config.rb".freeze, "lib/complex_config/config.rb".freeze, "lib/complex_config/encryption.rb".freeze, "lib/complex_config/errors.rb".freeze, "lib/complex_config/key_source.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, "spec/complex_config/config_spec.rb".freeze, "spec/complex_config/encryption_spec.rb".freeze, "spec/complex_config/key_source_spec.rb".freeze, "spec/complex_config/plugins_spec.rb".freeze, "spec/complex_config/provider_spec.rb".freeze, "spec/complex_config/settings_spec.rb".freeze, "spec/complex_config/shortcuts_spec.rb".freeze, "spec/config/broken_config.yml".freeze, "spec/config/config.yml".freeze, "spec/config/master.key".freeze, "spec/config/with-key-file.yml.enc".freeze, "spec/config/with-key-file.yml.key".freeze, "spec/config/without-key-file.yml.enc".freeze, "spec/spec_helper.rb".freeze]
|
|
16
|
+
s.files = [".gitignore".freeze, ".rspec".freeze, ".tool-versions".freeze, ".travis.yml".freeze, ".utilsrc".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/complex_config".freeze, "complex_config.gemspec".freeze, "config/products.yml".freeze, "lib/complex_config.rb".freeze, "lib/complex_config/config.rb".freeze, "lib/complex_config/encryption.rb".freeze, "lib/complex_config/errors.rb".freeze, "lib/complex_config/key_source.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, "spec/complex_config/config_spec.rb".freeze, "spec/complex_config/encryption_spec.rb".freeze, "spec/complex_config/key_source_spec.rb".freeze, "spec/complex_config/plugins_spec.rb".freeze, "spec/complex_config/provider_spec.rb".freeze, "spec/complex_config/settings_spec.rb".freeze, "spec/complex_config/shortcuts_spec.rb".freeze, "spec/config/broken_config.yml".freeze, "spec/config/config.yml".freeze, "spec/config/master.key".freeze, "spec/config/with-key-file.yml.enc".freeze, "spec/config/with-key-file.yml.key".freeze, "spec/config/without-key-file.yml.enc".freeze, "spec/spec_helper.rb".freeze]
|
|
17
17
|
s.homepage = "https://github.com/flori/complex_config".freeze
|
|
18
18
|
s.licenses = ["Apache-2.0".freeze]
|
|
19
19
|
s.rdoc_options = ["--title".freeze, "ComplexConfig -- configuration library".freeze, "--main".freeze, "README.md".freeze]
|
|
20
|
-
s.rubygems_version = "3.
|
|
20
|
+
s.rubygems_version = "3.2.15".freeze
|
|
21
21
|
s.summary = "configuration library".freeze
|
|
22
22
|
s.test_files = ["spec/complex_config/config_spec.rb".freeze, "spec/complex_config/encryption_spec.rb".freeze, "spec/complex_config/key_source_spec.rb".freeze, "spec/complex_config/plugins_spec.rb".freeze, "spec/complex_config/provider_spec.rb".freeze, "spec/complex_config/settings_spec.rb".freeze, "spec/complex_config/shortcuts_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
|
23
23
|
|
|
24
24
|
if s.respond_to? :specification_version then
|
|
25
25
|
s.specification_version = 4
|
|
26
|
+
end
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
else
|
|
37
|
-
s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
|
|
38
|
-
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
|
39
|
-
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
|
40
|
-
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
|
41
|
-
s.add_dependency(%q<monetize>.freeze, [">= 0"])
|
|
42
|
-
s.add_dependency(%q<json>.freeze, [">= 0"])
|
|
43
|
-
s.add_dependency(%q<tins>.freeze, [">= 0"])
|
|
44
|
-
s.add_dependency(%q<mize>.freeze, ["~> 0.3", ">= 0.3.4"])
|
|
45
|
-
end
|
|
28
|
+
if s.respond_to? :add_runtime_dependency then
|
|
29
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
|
|
30
|
+
s.add_development_dependency(%q<rake>.freeze, [">= 0"])
|
|
31
|
+
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
|
32
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
|
33
|
+
s.add_development_dependency(%q<monetize>.freeze, [">= 0"])
|
|
34
|
+
s.add_runtime_dependency(%q<json>.freeze, [">= 0"])
|
|
35
|
+
s.add_runtime_dependency(%q<tins>.freeze, [">= 0"])
|
|
36
|
+
s.add_runtime_dependency(%q<mize>.freeze, ["~> 0.3", ">= 0.3.4"])
|
|
46
37
|
else
|
|
47
38
|
s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
|
|
48
39
|
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
|
@@ -65,7 +65,7 @@ class ComplexConfig::Provider
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def config_dir
|
|
68
|
-
@config_dir || (defined?(Rails) && Rails.root || Pathname.pwd) + 'config'
|
|
68
|
+
@config_dir || (defined?(Rails) && Rails.respond_to?(:root) && Rails.root || Pathname.pwd) + 'config'
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def pathname(name)
|
|
@@ -169,14 +169,24 @@ class ComplexConfig::Provider
|
|
|
169
169
|
self
|
|
170
170
|
end
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
if RUBY_VERSION >= "3"
|
|
173
|
+
def evaluate(pathname, data)
|
|
174
|
+
erb = ::ERB.new(data, trim_mode: '-')
|
|
175
|
+
erb.filename = pathname.to_s
|
|
176
|
+
erb.result
|
|
177
|
+
end
|
|
178
|
+
else
|
|
179
|
+
def evaluate(pathname, data)
|
|
180
|
+
erb = ::ERB.new(data, nil, '-')
|
|
181
|
+
erb.filename = pathname.to_s
|
|
182
|
+
erb.result
|
|
183
|
+
end
|
|
176
184
|
end
|
|
177
185
|
|
|
178
186
|
def env
|
|
179
|
-
@env || defined?(Rails) && Rails.env
|
|
187
|
+
@env || defined?(Rails) && Rails.respond_to?(:env) && Rails.env ||
|
|
188
|
+
ENV['RAILS_ENV'] ||
|
|
189
|
+
'development'
|
|
180
190
|
end
|
|
181
191
|
|
|
182
192
|
attr_writer :env
|
|
@@ -111,7 +111,7 @@ class ComplexConfig::Settings < BasicObject
|
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
def ==(other)
|
|
114
|
-
to_h == other.to_h
|
|
114
|
+
other.respond_to?(:to_h) && to_h == other.to_h
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
def to_yaml
|
|
@@ -133,7 +133,7 @@ class ComplexConfig::Settings < BasicObject
|
|
|
133
133
|
def to_s(pair_sep: ' = ', path_sep: ?.)
|
|
134
134
|
empty? and return self.class.name
|
|
135
135
|
pathes(path_sep: path_sep).inject('') do |result, (path, value)|
|
|
136
|
-
result
|
|
136
|
+
result + "#{path}#{pair_sep}#{value.inspect}\n"
|
|
137
137
|
end
|
|
138
138
|
end
|
|
139
139
|
|
|
@@ -187,7 +187,7 @@ class ComplexConfig::Settings < BasicObject
|
|
|
187
187
|
freeze
|
|
188
188
|
end
|
|
189
189
|
|
|
190
|
-
def
|
|
190
|
+
def attribute_get(name)
|
|
191
191
|
if !attribute_set?(name) and
|
|
192
192
|
value = ::ComplexConfig::Provider.apply_plugins(self, name)
|
|
193
193
|
then
|
|
@@ -197,6 +197,16 @@ class ComplexConfig::Settings < BasicObject
|
|
|
197
197
|
end
|
|
198
198
|
end
|
|
199
199
|
|
|
200
|
+
alias [] attribute_get
|
|
201
|
+
|
|
202
|
+
def attribute_get!(name)
|
|
203
|
+
if attribute_set?(name)
|
|
204
|
+
attribute_get(name)
|
|
205
|
+
else
|
|
206
|
+
raise ::ComplexConfig::AttributeMissing, "no attribute named #{name.inspect}"
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
200
210
|
def []=(name, value)
|
|
201
211
|
@table[name.to_sym] = value
|
|
202
212
|
end
|
|
@@ -133,6 +133,11 @@ EOT
|
|
|
133
133
|
expect(settings.foo.baz?).to be_falsy
|
|
134
134
|
end
|
|
135
135
|
|
|
136
|
+
it 'can trigger exception on attribute get' do
|
|
137
|
+
expect(settings.foo.attribute_get!(:bar)).to be_truthy
|
|
138
|
+
expect { settings.foo.attribute_get!(:baz) }.to raise_error ComplexConfig::AttributeMissing
|
|
139
|
+
end
|
|
140
|
+
|
|
136
141
|
it 'handles arrays correctly' do
|
|
137
142
|
settings = described_class[ary: [ 1, { hsh: 2 }, 3 ]]
|
|
138
143
|
expect(settings.to_h).to eq(ary: [ 1, { hsh: 2 }, 3 ])
|
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.19.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gem_hadar
|
|
@@ -155,6 +155,7 @@ extra_rdoc_files:
|
|
|
155
155
|
files:
|
|
156
156
|
- ".gitignore"
|
|
157
157
|
- ".rspec"
|
|
158
|
+
- ".tool-versions"
|
|
158
159
|
- ".travis.yml"
|
|
159
160
|
- ".utilsrc"
|
|
160
161
|
- COPYING
|
|
@@ -200,7 +201,7 @@ homepage: https://github.com/flori/complex_config
|
|
|
200
201
|
licenses:
|
|
201
202
|
- Apache-2.0
|
|
202
203
|
metadata: {}
|
|
203
|
-
post_install_message:
|
|
204
|
+
post_install_message:
|
|
204
205
|
rdoc_options:
|
|
205
206
|
- "--title"
|
|
206
207
|
- ComplexConfig -- configuration library
|
|
@@ -219,8 +220,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
219
220
|
- !ruby/object:Gem::Version
|
|
220
221
|
version: '0'
|
|
221
222
|
requirements: []
|
|
222
|
-
rubygems_version: 3.
|
|
223
|
-
signing_key:
|
|
223
|
+
rubygems_version: 3.2.15
|
|
224
|
+
signing_key:
|
|
224
225
|
specification_version: 4
|
|
225
226
|
summary: configuration library
|
|
226
227
|
test_files:
|