hierarchical_config 0.9 → 0.10

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: a86651ea049840bd9eecbc107b5e58646d4977c2
4
- data.tar.gz: f04aa3fb370aef955a4bd908238c2a8852732151
3
+ metadata.gz: c30b204410cfb69963e7b0dabe5d32d8f4aed32e
4
+ data.tar.gz: a66d608b7f290a908b2f747dec58ae95477f69df
5
5
  SHA512:
6
- metadata.gz: ffac763d52d6c550b67b7462bdf730a82d543ab438f6a26830ce8dd0921b179bb1d2cd221e86ad2dc0b056157e0cde73feb8823554e80a83f6ec6b9c783257e4
7
- data.tar.gz: d4fb91a9cd2c9f44c0923409f9cad436e98f7bc642c05d5de4fb30115fa2c392961c2f2b0c2c7727048393bee18a373c576d3445e2028b75ef0ae85595e54fcb
6
+ metadata.gz: 6a21680799fa258505d9fff32d86f56f01ccf6c8e246229fc104c8c5703826702518e687796a2cf0e11ca4e4bbc69ba6cfa79befce47c891c78bd887b0e0f44a
7
+ data.tar.gz: d7bda2e2985a863e1a78a2ab6e7211678803df08ffe881d74ea9e7c3f855fbb9aed742eab4b8bc80c322a2492967098b1f650651c39cbca600d37a82899c0bfa
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hierarchical_config (0.8)
4
+ hierarchical_config (0.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -38,4 +38,4 @@ DEPENDENCIES
38
38
  rspec (~> 3.0)
39
39
 
40
40
  BUNDLED WITH
41
- 1.16.4
41
+ 1.16.6
@@ -1,3 +1,3 @@
1
1
  module HierarchicalConfig
2
- VERSION = "0.9"
2
+ VERSION = "0.10"
3
3
  end
@@ -59,14 +59,14 @@ module HierarchicalConfig
59
59
  end
60
60
 
61
61
  class << self
62
- def load_config( name, dir, environment )
62
+ def load_config( name, dir, environment, preprocess_with=:erb )
63
63
  primary_config_file = "#{dir}/#{name}.yml"
64
64
  overrides_config_file = "#{dir}/#{name}-overrides.yml"
65
65
 
66
- config_hash = load_hash_for_env( primary_config_file, environment )
66
+ config_hash = load_hash_for_env( primary_config_file, environment, preprocess_with )
67
67
 
68
68
  if File.exists?( overrides_config_file )
69
- overrides_config_hash = load_hash_for_env( overrides_config_file, environment )
69
+ overrides_config_hash = load_hash_for_env( overrides_config_file, environment, preprocess_with )
70
70
  config_hash = deep_merge( config_hash, overrides_config_hash )
71
71
  end
72
72
 
@@ -77,8 +77,17 @@ module HierarchicalConfig
77
77
  config_hash
78
78
  end
79
79
 
80
- def load_hash_for_env( file, environment )
81
- yaml_config = YAML::load(ERB.new(IO.read(file)).result)
80
+ def load_hash_for_env( file, environment, preprocess_with )
81
+ file_contents = IO.read(file)
82
+ yaml_contents = case preprocess_with
83
+ when :erb
84
+ ERB.new(file_contents).result
85
+ when nil
86
+ file_contents
87
+ else
88
+ raise "Unknown preprocessor <#{preprocess_with}>"
89
+ end
90
+ yaml_config = YAML::load(yaml_contents)
82
91
 
83
92
  ordered_stanza_labels = []
84
93
  ordered_stanza_labels << 'defaults' if yaml_config.key? 'defaults'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hierarchical_config
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.9'
4
+ version: '0.10'
5
5
  platform: ruby
6
6
  authors:
7
7
  - timgaleckas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2018-10-07 00:00:00.000000000 Z
13
+ date: 2018-12-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler