config-factory 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b31bc2f2074a9f1e66efe1d58e5e224b254e4820
|
4
|
+
data.tar.gz: 5afe13b48946fdcbf269d10d7a57399e354b6afe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33047cf037e5d3d3443b31839dd3ea79831bee2cf57782fd863b820c721069c47bfb01e8d026e040ab366e5df14ea2a8d652fa857b0e931b1abf31bc6fff9627
|
7
|
+
data.tar.gz: a41e560799880666b8de8859b481bdab1c9d520a1d24320504b42d89c178151b0c01b4ff504c89c7ed533979e1a02443566a6110c7a92c5a6f18bc97843ea921
|
data/CHANGES.md
CHANGED
@@ -15,11 +15,16 @@ module Config
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def for_environment(env,
|
19
|
-
arg_hash = env.args_for(
|
18
|
+
def for_environment(env, config_name)
|
19
|
+
arg_hash = env.args_for(config_name)
|
20
20
|
build_from(arg_hash)
|
21
21
|
end
|
22
22
|
|
23
|
+
def from_file(path, config_name)
|
24
|
+
env = Environment.load_file(path)
|
25
|
+
for_environment(env, config_name)
|
26
|
+
end
|
27
|
+
|
23
28
|
def build_from(arg_hash)
|
24
29
|
args = deep_symbolize_keys(arg_hash)
|
25
30
|
key_value = args.delete(product_key)
|
@@ -42,6 +42,17 @@ module Config
|
|
42
42
|
expect { SourceConfig.for_environment(env, :source) }.to raise_error(ArgumentError, /SourceConfig.*protocol.*Elvis/)
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
describe '#from_file' do
|
47
|
+
it 'builds the correct class with the correct config' do
|
48
|
+
product = SourceConfig.from_file('spec/data/single-environment.yml', :source)
|
49
|
+
expect(product).to be_an(OAISourceConfig)
|
50
|
+
args = { oai_base_url: URI('http://oai.example.org/oai'), metadata_prefix: 'some_prefix', set: 'some_set', seconds_granularity: true }
|
51
|
+
args.each do |k, v|
|
52
|
+
expect(product.send(k)).to eq(v)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
45
56
|
end
|
46
57
|
end
|
47
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|