config-factory 0.0.5 → 0.0.6
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85d51fce96572d3dba52936c624787dfc7318cbc
|
|
4
|
+
data.tar.gz: ee7cdc6973f8918992858021eabde2d92d272f2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74c6acb13ffe5a9892e6430b91452ca3819b149cd8d3bacb62159d2fd60ad1ea872c1043918b753279433a4e444c8d08a27c082111d2bd2963af7d4f2e8306d2
|
|
7
|
+
data.tar.gz: e7d2d643473f1de988680e736f8bbfae5e78df564259d6550d17e9409de7d5c75237e2d6d44aeae2b02858885ad6bfdd9abc71be99e631ce327c32a19e6ca3f2
|
data/CHANGES.md
CHANGED
|
@@ -17,6 +17,7 @@ module Config
|
|
|
17
17
|
|
|
18
18
|
def for_environment(env, config_name)
|
|
19
19
|
arg_hash = env.args_for(config_name)
|
|
20
|
+
fail ArgumentError, "no #{self} arguments found for config #{config_name} in environment #{env}" unless arg_hash
|
|
20
21
|
build_from(arg_hash)
|
|
21
22
|
end
|
|
22
23
|
|
|
@@ -26,7 +27,9 @@ module Config
|
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def build_from(arg_hash)
|
|
30
|
+
fail ArgumentError, "nil argument hash passed to #{self}.build_from" unless arg_hash
|
|
29
31
|
args = deep_symbolize_keys(arg_hash)
|
|
32
|
+
fail ArgumentError, "product key #{product_key} not found in argument hash #{args}" unless args.key?(product_key)
|
|
30
33
|
key_value = args.delete(product_key)
|
|
31
34
|
product_class = products[key_value]
|
|
32
35
|
fail ArgumentError, "No #{name} product class found for #{product_key}: #{key_value}" unless product_class
|
|
@@ -48,6 +48,44 @@ module Config
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
|
+
|
|
52
|
+
describe '#to_s' do
|
|
53
|
+
it 'includes the name' do
|
|
54
|
+
env = Environment.load_file('spec/data/single-environment.yml')
|
|
55
|
+
expect(env.to_s).to include(Environments::DEFAULT_ENVIRONMENT.to_s)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'includes the hash' do
|
|
59
|
+
h = {
|
|
60
|
+
'db' =>
|
|
61
|
+
{
|
|
62
|
+
'adapter' => 'mysql2',
|
|
63
|
+
'encoding' => 'utf8',
|
|
64
|
+
'pool' => 5,
|
|
65
|
+
'database' => 'example_pord',
|
|
66
|
+
'host' => 'mysql-dev.example.org',
|
|
67
|
+
'port' => 3306
|
|
68
|
+
},
|
|
69
|
+
'source' => {
|
|
70
|
+
'protocol' => 'OAI',
|
|
71
|
+
'oai_base_url' => 'http://oai.example.org/oai',
|
|
72
|
+
'metadata_prefix' => 'some_prefix',
|
|
73
|
+
'set' => 'some_set',
|
|
74
|
+
'seconds_granularity' => true
|
|
75
|
+
},
|
|
76
|
+
'index' => {
|
|
77
|
+
'adapter' => 'solr',
|
|
78
|
+
'url' => 'http://solr.example.org/',
|
|
79
|
+
'proxy' => 'http://foo:bar@proxy.example.com/',
|
|
80
|
+
'open_timeout' => 120,
|
|
81
|
+
'read_timeout' => 300
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
env = Environment.load_hash(h)
|
|
85
|
+
expect(env.to_s).to include(h.to_s)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
51
89
|
end
|
|
52
90
|
end
|
|
53
91
|
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.6
|
|
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-03-
|
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|