snappconfig 0.0.4 → 0.0.5

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: 4fdb18518b031de8fc2fa843b78f05db17f31098
4
- data.tar.gz: 9b859473c81ad042143f05f3ae2b65033e270d5d
3
+ metadata.gz: 6254cbdf4db21d11be05d39c04457b3ad2a00f72
4
+ data.tar.gz: 1abc5b054d7e691fe533340f878c09faf05784c7
5
5
  SHA512:
6
- metadata.gz: 01a6858ea79834175afc7b4bf2944404c6244d024671c4494a17523a7cc448eadd48fc1e7478368bc06885a552ca4a3537d2843144a7c35796e2ce4138dd99e3
7
- data.tar.gz: 5cfe591a7709e900c1d1141ed4bc055ed7f92d03782403ecc9ff97c846ab54a018b799abae84bec70b9dedffb1fb1dcc61887989c4364ea1b2546e10f12fe3ef
6
+ metadata.gz: 79793ae19f9bb70b9b9f3c3657d90cde13af1ae7a43cb7a5a9cf0434e07156eb4345dcb457ac3676ea3202690840d5a282716c44ee895c24999da22ebbc7d1a8
7
+ data.tar.gz: 4718a54bb541408560e26ca6ea38028314cac7a50eee6666ab6207fe7c68cfa18eba901ffe67b8800c6878281c58e6ad04035c33ed1ff637b571c14dfe8f6677
@@ -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
- # 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.clone
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
- Snappconfig.environments.each do |environment|
17
- appconfig.delete(environment)
18
- end
19
+ Snappconfig.environments.each { |environment| appconfig.delete(environment) }
19
20
 
20
- check_required(appconfig)
21
+ check_required(appconfig)
21
22
 
22
- # Assign ENV values...
23
- if appconfig.has_key?('ENV')
24
- appconfig['ENV'].each do |key, value|
25
- ENV[key] = value.to_s unless value.kind_of? Hash
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
- # ... and clear ENV values from CONFIG so we don't have duplicate data:
28
- appconfig.delete('ENV')
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.4"
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}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snappconfig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yarin Kessler