snappconfig 0.0.4 → 0.0.5
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 +21 -19
- 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: 6254cbdf4db21d11be05d39c04457b3ad2a00f72
|
4
|
+
data.tar.gz: 1abc5b054d7e691fe533340f878c09faf05784c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79793ae19f9bb70b9b9f3c3657d90cde13af1ae7a43cb7a5a9cf0434e07156eb4345dcb457ac3676ea3202690840d5a282716c44ee895c24999da22ebbc7d1a8
|
7
|
+
data.tar.gz: 4718a54bb541408560e26ca6ea38028314cac7a50eee6666ab6207fe7c68cfa18eba901ffe67b8800c6878281c58e6ad04035c33ed1ff637b571c14dfe8f6677
|
data/lib/snappconfig/railtie.rb
CHANGED
@@ -6,31 +6,33 @@ module Snappconfig
|
|
6
6
|
class Railtie < ::Rails::Railtie
|
7
7
|
|
8
8
|
config.before_configuration do
|
9
|
+
|
10
|
+
is_rake_task = defined? Rake
|
11
|
+
if !is_rake_task
|
12
|
+
|
13
|
+
# Look for CONFIG file in ENV (For Heroku) or else load from file system:
|
14
|
+
appconfig = ENV['CONFIG'] ? YAML.load(ENV['CONFIG']) : Snappconfig.merged_raw.clone
|
9
15
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
appconfig.deep_merge! appconfig.fetch('defaults', {})
|
14
|
-
appconfig.deep_merge! appconfig.fetch(Rails.env, {})
|
16
|
+
appconfig.deep_merge! appconfig.fetch('defaults', {})
|
17
|
+
appconfig.deep_merge! appconfig.fetch(Rails.env, {})
|
15
18
|
|
16
|
-
|
17
|
-
appconfig.delete(environment)
|
18
|
-
end
|
19
|
+
Snappconfig.environments.each { |environment| appconfig.delete(environment) }
|
19
20
|
|
20
|
-
|
21
|
+
check_required(appconfig)
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
# Assign ENV values and then delete them from CONFIG so we don't have duplicate data:
|
24
|
+
if appconfig.has_key?('ENV')
|
25
|
+
appconfig['ENV'].each do |key, value|
|
26
|
+
ENV[key] = value.to_s unless value.kind_of? Hash
|
27
|
+
end
|
28
|
+
appconfig.delete('ENV')
|
26
29
|
end
|
27
|
-
|
28
|
-
appconfig
|
30
|
+
|
31
|
+
appconfig = recursively_symbolize_keys(appconfig)
|
32
|
+
CONFIG.merge! appconfig
|
33
|
+
|
29
34
|
end
|
30
35
|
|
31
|
-
appconfig = recursively_symbolize_keys(appconfig)
|
32
|
-
CONFIG.merge! appconfig
|
33
|
-
|
34
36
|
end
|
35
37
|
|
36
38
|
rake_tasks do
|
@@ -43,7 +45,7 @@ module Snappconfig
|
|
43
45
|
|
44
46
|
hash.each_pair do |key,value|
|
45
47
|
if value == '_REQUIRED'
|
46
|
-
raise "The configuration value #{key} is required but was not supplied. Check your application.yml file(s)."
|
48
|
+
raise "The configuration value '#{key}' is required but was not supplied. Check your application.yml file(s)."
|
47
49
|
elsif value.is_a?(Hash)
|
48
50
|
check_required(value)
|
49
51
|
end
|
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.5"
|
8
8
|
spec.authors = ["Yarin Kessler"]
|
9
9
|
spec.email = "ykessler@appgrinders.com"
|
10
10
|
spec.summary = %q{Smarter Rails configuration with YAML}
|