snappconfig 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/snappconfig/railtie.rb +10 -5
- data/snappconfig.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 625e64ac4dd886d0d6d599a022df0ad493ab15ea
|
4
|
+
data.tar.gz: fc9b9b96c0fe406a7eb6abf343cc86840a61e0f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 094c0c42ee8a95efe4f3946ae1bb4e851e458103078739085acfaa35ffb37b4674115f089abc72ad33a96681f8283c4fa33567686319eae07a2cd9a208f0006e
|
7
|
+
data.tar.gz: 92a2be72ad3bea65694c2656d20636f12b27a11a8a23f3fffb909fc4bb42fde9a73292b4247d5929ac54c432b6711b6963619f1bb8e52e8220ef51ecbcb01f90
|
data/lib/snappconfig/railtie.rb
CHANGED
@@ -13,10 +13,6 @@ module Snappconfig
|
|
13
13
|
appconfig.deep_merge! appconfig.fetch('defaults', {})
|
14
14
|
appconfig.deep_merge! appconfig.fetch(Rails.env, {})
|
15
15
|
|
16
|
-
Snappconfig.environments.each do |environment|
|
17
|
-
appconfig.delete(environment)
|
18
|
-
end
|
19
|
-
|
20
16
|
check_required(appconfig)
|
21
17
|
|
22
18
|
# Assign ENV values...
|
@@ -26,6 +22,9 @@ module Snappconfig
|
|
26
22
|
end
|
27
23
|
# ... and clear ENV values from CONFIG so we don't have duplicate data:
|
28
24
|
appconfig.delete('ENV')
|
25
|
+
appconfig.each do |key,value|
|
26
|
+
value.delete('ENV') if value.is_a?(Hash) && value.has_key?('ENV')
|
27
|
+
end
|
29
28
|
end
|
30
29
|
|
31
30
|
appconfig = recursively_symbolize_keys(appconfig)
|
@@ -40,7 +39,13 @@ module Snappconfig
|
|
40
39
|
private
|
41
40
|
|
42
41
|
def check_required(hash)
|
43
|
-
|
42
|
+
|
43
|
+
env_hash = hash.clone
|
44
|
+
Snappconfig.environments.each do |environment|
|
45
|
+
env_hash.delete(environment)
|
46
|
+
end
|
47
|
+
|
48
|
+
env_hash.each_pair do |key,value|
|
44
49
|
if value == '_REQUIRED'
|
45
50
|
raise "The configuration value #{key} is required but was not supplied. Check your application.yml file(s)."
|
46
51
|
elsif value.is_a?(Hash)
|
data/snappconfig.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "snappconfig"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.3"
|
8
8
|
spec.authors = ["Yarin Kessler"]
|
9
9
|
spec.email = "ykessler@appgrinders.com"
|
10
10
|
spec.summary = %q{Smarter Rails configuration with YAML}
|