collapsium-config 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5580fb8452b9b3d0c23ee9a987638fc870317e4
4
- data.tar.gz: c3f68cac77df64fc6bc9175ebbcfde04d845d9d3
3
+ metadata.gz: 831b6eb064c405db8797886058469fb8f613c0fc
4
+ data.tar.gz: c38ef78dd89d8a009e01719aa6860c4b6d953697
5
5
  SHA512:
6
- metadata.gz: 8e0fdc2746cb84e896168f26ade95ce81374848bbb536d18352b3f761648808c6f2c8a7696385c3fee1a4d052261c150d509c9cb1a77162d22470f4ce3c09f42
7
- data.tar.gz: 4b7fdb6738ec3dc159a4e30bc8ecbecfa33690f2f09220f7db3c353fe81d95e9dcbc6b4fc11417b5dbf7002087122ad368b81085155ceabb7ca4f165868a26c0
6
+ metadata.gz: f97ddbf8c8973f5d2590d45da0ab07778295dccc7078836002d899bc41920e75b8e423440af56ec516567fabbf71f3c35b9310634f2e640d6e75f50ec87e36d2
7
+ data.tar.gz: f0181fba285ca14f6153713316683a0b218bb7709814d01d89039b07c8d74f3f308f1bc71cf5d30c456b6033b1074eba3943cacbf41f8f8416035eb556e8ad3a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- collapsium-config (0.2.0)
4
+ collapsium-config (0.2.1)
5
5
  collapsium (~> 0.4)
6
6
 
7
7
  GEM
@@ -10,7 +10,7 @@ GEM
10
10
  ast (2.3.0)
11
11
  codeclimate-test-reporter (0.6.0)
12
12
  simplecov (>= 0.7.1, < 1.0.0)
13
- collapsium (0.4.0)
13
+ collapsium (0.4.1)
14
14
  diff-lcs (1.2.5)
15
15
  docile (1.1.5)
16
16
  json (2.0.2)
@@ -147,7 +147,7 @@ module Collapsium
147
147
  # Parse the contents.
148
148
  config = parse(base.extname, contents, template_data)
149
149
 
150
- return base, UberHash.new(hashify(config))
150
+ return base, Configuration.new(hashify(config))
151
151
  end
152
152
 
153
153
  def load_local_config(base, template_data)
@@ -166,7 +166,7 @@ module Collapsium
166
166
 
167
167
  local_config = parse(base.extname, contents, template_data)
168
168
 
169
- return local, UberHash.new(hashify(local_config))
169
+ return local, Configuration.new(hashify(local_config))
170
170
  end
171
171
 
172
172
  def hashify(data)
@@ -9,6 +9,6 @@
9
9
  module Collapsium
10
10
  module Config
11
11
  # The current release version
12
- VERSION = "0.2.0".freeze
12
+ VERSION = "0.2.1".freeze
13
13
  end # module Config
14
14
  end # module Collapsium
@@ -4,6 +4,7 @@ require_relative '../lib/collapsium-config/configuration'
4
4
  describe Collapsium::Config::Configuration do
5
5
  before do
6
6
  @data_path = File.join(File.dirname(__FILE__), 'data')
7
+ ENV.delete("BAZ")
7
8
  end
8
9
 
9
10
  describe "basic file loading" do
@@ -81,7 +82,6 @@ describe Collapsium::Config::Configuration do
81
82
  ENV["BAZ"] = "override"
82
83
  expect(cfg["foo"]).to eql "bar"
83
84
  expect(cfg["baz"]).to eql "override"
84
- ENV.delete("BAZ")
85
85
  end
86
86
 
87
87
  it "parses JSON when overriding from the environment" do
@@ -92,7 +92,6 @@ describe Collapsium::Config::Configuration do
92
92
  expect(cfg["foo"]).to eql "bar"
93
93
  expect(cfg["baz"].is_a?(Hash)).to be_truthy
94
94
  expect(cfg["baz.json_key"]).to eql "json_value"
95
- ENV.delete("BAZ")
96
95
  end
97
96
  end
98
97
 
data/spec/data/global.yml CHANGED
@@ -1,2 +1,4 @@
1
1
  ---
2
2
  test: 42
3
+ some:
4
+ path: 123
data/spec/module_spec.rb CHANGED
@@ -6,6 +6,9 @@ include Collapsium::Config
6
6
  describe Collapsium::Config do
7
7
  before do
8
8
  @data_path = File.join(File.dirname(__FILE__), 'data')
9
+ ENV.delete("SOME_PATH")
10
+ ENV.delete("SOME")
11
+ ENV.delete("PATH")
9
12
  end
10
13
 
11
14
  it "fails to load configuration from the default path (it does not exist)" do
@@ -39,5 +42,18 @@ describe Collapsium::Config do
39
42
 
40
43
  expect(cfg1.object_id).to eql cfg2.object_id
41
44
  end
45
+
46
+ it "returns a config hash capable of environment overrides" do
47
+ Collapsium::Config.config_file = File.join(@data_path, 'global.yml')
48
+
49
+ # Pre environment manipulation
50
+ expect(config["some.path"]).to eql 123
51
+
52
+ # With environment manipulation
53
+ ENV["SOME_PATH"] = "override"
54
+
55
+ expect(config["some.path"]).to eql "override"
56
+ expect(config["some"]["path"]).to eql "override"
57
+ end
42
58
  end
43
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collapsium-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Finkhaeuser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-17 00:00:00.000000000 Z
11
+ date: 2016-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler