snappconfig 0.0.3 → 0.0.4
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 +6 -10
- data/lib/snappconfig/tasks.rake +1 -1
- 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: 4fdb18518b031de8fc2fa843b78f05db17f31098
|
4
|
+
data.tar.gz: 9b859473c81ad042143f05f3ae2b65033e270d5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01a6858ea79834175afc7b4bf2944404c6244d024671c4494a17523a7cc448eadd48fc1e7478368bc06885a552ca4a3537d2843144a7c35796e2ce4138dd99e3
|
7
|
+
data.tar.gz: 5cfe591a7709e900c1d1141ed4bc055ed7f92d03782403ecc9ff97c846ab54a018b799abae84bec70b9dedffb1fb1dcc61887989c4364ea1b2546e10f12fe3ef
|
data/lib/snappconfig/railtie.rb
CHANGED
@@ -8,11 +8,15 @@ module Snappconfig
|
|
8
8
|
config.before_configuration do
|
9
9
|
|
10
10
|
# Look for CONFIG file in ENV (For Heroku) or else load from file system:
|
11
|
-
appconfig = ENV['CONFIG'] ? YAML.load(ENV['CONFIG']) : Snappconfig.merged_raw
|
11
|
+
appconfig = ENV['CONFIG'] ? YAML.load(ENV['CONFIG']) : Snappconfig.merged_raw.clone
|
12
12
|
|
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
|
+
|
16
20
|
check_required(appconfig)
|
17
21
|
|
18
22
|
# Assign ENV values...
|
@@ -22,9 +26,6 @@ module Snappconfig
|
|
22
26
|
end
|
23
27
|
# ... and clear ENV values from CONFIG so we don't have duplicate data:
|
24
28
|
appconfig.delete('ENV')
|
25
|
-
appconfig.each do |key,value|
|
26
|
-
value.delete('ENV') if value.is_a?(Hash) && value.has_key?('ENV')
|
27
|
-
end
|
28
29
|
end
|
29
30
|
|
30
31
|
appconfig = recursively_symbolize_keys(appconfig)
|
@@ -40,12 +41,7 @@ module Snappconfig
|
|
40
41
|
|
41
42
|
def check_required(hash)
|
42
43
|
|
43
|
-
|
44
|
-
Snappconfig.environments.each do |environment|
|
45
|
-
env_hash.delete(environment)
|
46
|
-
end
|
47
|
-
|
48
|
-
env_hash.each_pair do |key,value|
|
44
|
+
hash.each_pair do |key,value|
|
49
45
|
if value == '_REQUIRED'
|
50
46
|
raise "The configuration value #{key} is required but was not supplied. Check your application.yml file(s)."
|
51
47
|
elsif value.is_a?(Hash)
|
data/lib/snappconfig/tasks.rake
CHANGED
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.4"
|
8
8
|
spec.authors = ["Yarin Kessler"]
|
9
9
|
spec.email = "ykessler@appgrinders.com"
|
10
10
|
spec.summary = %q{Smarter Rails configuration with YAML}
|