configurate 0.5.0 → 0.6.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/Changelog.md +5 -0
- data/README.md +1 -1
- data/lib/configurate/lookup_chain.rb +5 -5
- data/spec/configurate/lookup_chain_spec.rb +5 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6cbde7141caa3d2c774fff3a2cc73174410582d050682b5d4804870af484b07
|
4
|
+
data.tar.gz: 29daacb8ee699fe7ab37d320f78f9fb5a2722c825b28dac9077cd50ce9abc383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15bc4f73d51fa365b6de1386f73d3cd92aaf72bdb9bed931c75a7046ca7a79a15beb43f0315d8db5f4d0d628c27b8e533fbadd063b1c2898f36dd0e89e23e563
|
7
|
+
data.tar.gz: b5e8260b309c38f58479590b07c849889c227ff51b5fd5945e689f768b0b0f69ded625c6b5fb89eabdd380c1647ce7f2c2dd3d539f9e3a45a69f31f8ca56ab27
|
data/Changelog.md
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,7 @@ your default settings with a user configuration file and let those be overridden
|
|
10
10
|
by environment variables. The query interface allows to group and nest your configuration options
|
11
11
|
to a practically unlimited level.
|
12
12
|
|
13
|
-
Configurate supports Ruby 2.
|
13
|
+
Configurate supports Ruby 2.7 or later.
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
@@ -12,15 +12,15 @@ module Configurate
|
|
12
12
|
# they are added, so the order is important.
|
13
13
|
#
|
14
14
|
# @param provider [#lookup]
|
15
|
-
# @param
|
15
|
+
# @param ... the arguments passed to the providers constructor
|
16
16
|
# @raise [ArgumentError] if an invalid provider is given
|
17
17
|
# @return [void]
|
18
|
-
def add_provider(provider,
|
18
|
+
def add_provider(provider, ...)
|
19
19
|
unless provider.respond_to?(:instance_methods) && provider.instance_methods.include?(:lookup)
|
20
20
|
raise ArgumentError, "the given provider does not respond to lookup"
|
21
21
|
end
|
22
22
|
|
23
|
-
@provider << provider.new(
|
23
|
+
@provider << provider.new(...)
|
24
24
|
end
|
25
25
|
|
26
26
|
# Tries all providers in the order they were added to provide a response
|
@@ -31,11 +31,11 @@ module Configurate
|
|
31
31
|
# @param ... further args passed to the provider
|
32
32
|
# @return [Array,Hash,String,Boolean,nil] whatever the responding
|
33
33
|
# provider provides is casted to a {String}, except for some special values
|
34
|
-
def lookup(setting,
|
34
|
+
def lookup(setting, ...)
|
35
35
|
setting = SettingPath.new setting if setting.is_a? String
|
36
36
|
@provider.each do |provider|
|
37
37
|
begin
|
38
|
-
return special_value_or_string(provider.lookup(setting.clone,
|
38
|
+
return special_value_or_string(provider.lookup(setting.clone, ...))
|
39
39
|
rescue SettingNotFoundError; end
|
40
40
|
end
|
41
41
|
|
@@ -27,6 +27,11 @@ describe Configurate::LookupChain do
|
|
27
27
|
expect(ValidConfigurationProvider).to receive(:new).with(:extra)
|
28
28
|
subject.add_provider ValidConfigurationProvider, :extra
|
29
29
|
end
|
30
|
+
|
31
|
+
it "passes keyword args to the provider" do
|
32
|
+
expect(ValidConfigurationProvider).to receive(:new).with(required: false)
|
33
|
+
subject.add_provider ValidConfigurationProvider, required: false
|
34
|
+
end
|
30
35
|
end
|
31
36
|
|
32
37
|
describe "#lookup" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configurate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonne Haß
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -95,26 +95,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
95
|
requirements:
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 2.
|
98
|
+
version: 2.7.0
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.4.13
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Flexbile configuration system
|
109
109
|
test_files:
|
110
|
-
- spec/spec_helper.rb
|
111
110
|
- spec/configurate/lookup_chain_spec.rb
|
112
|
-
- spec/configurate/provider/toml_spec.rb
|
113
111
|
- spec/configurate/provider/dynamic_spec.rb
|
114
|
-
- spec/configurate/provider/yaml_spec.rb
|
115
|
-
- spec/configurate/provider/string_hash_spec.rb
|
116
112
|
- spec/configurate/provider/env_spec.rb
|
117
|
-
- spec/configurate/
|
113
|
+
- spec/configurate/provider/string_hash_spec.rb
|
114
|
+
- spec/configurate/provider/toml_spec.rb
|
115
|
+
- spec/configurate/provider/yaml_spec.rb
|
118
116
|
- spec/configurate/provider_spec.rb
|
117
|
+
- spec/configurate/proxy_spec.rb
|
119
118
|
- spec/configurate/setting_path_spec.rb
|
120
119
|
- spec/configurate_spec.rb
|
120
|
+
- spec/spec_helper.rb
|