config-factory 0.0.4 → 0.0.5

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: 96335fd2263daaa0f5ccaf7134db58b06dc7bdc0
4
- data.tar.gz: d669efdff53e922c0bd24a86d6f0f913e5ffaaad
3
+ metadata.gz: b31bc2f2074a9f1e66efe1d58e5e224b254e4820
4
+ data.tar.gz: 5afe13b48946fdcbf269d10d7a57399e354b6afe
5
5
  SHA512:
6
- metadata.gz: 6df85a30ae114c64489d21715fcc5604298260c7eae52f192257c2965fc165ff2a5216729c12348adcfce04988bd88cb1076d44d73c119645f5b0ac31a173a90
7
- data.tar.gz: 83ece573328e047f16fb0ce0d149d31a6551a2907670d0b53be7c91ef019b9825cc4547f23f40955de32ad8a204a2a527df4e43ad0bf9588d78209a1084ac0d5
6
+ metadata.gz: 33047cf037e5d3d3443b31839dd3ea79831bee2cf57782fd863b820c721069c47bfb01e8d026e040ab366e5df14ea2a8d652fa857b0e931b1abf31bc6fff9627
7
+ data.tar.gz: a41e560799880666b8de8859b481bdab1c9d520a1d24320504b42d89c178151b0c01b4ff504c89c7ed533979e1a02443566a6110c7a92c5a6f18bc97843ea921
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.0.5 (2 March 2016)
2
+
3
+ - Add `AbstractFactory#from_file`
4
+
1
5
  ## 0.0.4 (27 January 2016)
2
6
 
3
7
  - Make gemspec smart enough to handle SSH checkouts
@@ -15,11 +15,16 @@ module Config
15
15
  end
16
16
  end
17
17
 
18
- def for_environment(env, key)
19
- arg_hash = env.args_for(key)
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)
@@ -4,7 +4,7 @@ module Config
4
4
  NAME = 'config-factory'
5
5
 
6
6
  # The version of this gem
7
- VERSION = '0.0.4'
7
+ VERSION = '0.0.5'
8
8
 
9
9
  # The copyright notice for this gem
10
10
  COPYRIGHT = 'Copyright (c) 2016 The Regents of the University of California'
@@ -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
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-01-27 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler