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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 625e64ac4dd886d0d6d599a022df0ad493ab15ea
4
- data.tar.gz: fc9b9b96c0fe406a7eb6abf343cc86840a61e0f0
3
+ metadata.gz: 4fdb18518b031de8fc2fa843b78f05db17f31098
4
+ data.tar.gz: 9b859473c81ad042143f05f3ae2b65033e270d5d
5
5
  SHA512:
6
- metadata.gz: 094c0c42ee8a95efe4f3946ae1bb4e851e458103078739085acfaa35ffb37b4674115f089abc72ad33a96681f8283c4fa33567686319eae07a2cd9a208f0006e
7
- data.tar.gz: 92a2be72ad3bea65694c2656d20636f12b27a11a8a23f3fffb909fc4bb42fde9a73292b4247d5929ac54c432b6711b6963619f1bb8e52e8220ef51ecbcb01f90
6
+ metadata.gz: 01a6858ea79834175afc7b4bf2944404c6244d024671c4494a17523a7cc448eadd48fc1e7478368bc06885a552ca4a3537d2843144a7c35796e2ce4138dd99e3
7
+ data.tar.gz: 5cfe591a7709e900c1d1141ed4bc055ed7f92d03782403ecc9ff97c846ab54a018b799abae84bec70b9dedffb1fb1dcc61887989c4364ea1b2546e10f12fe3ef
@@ -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
- 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
+ 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)
@@ -2,7 +2,7 @@ require "shellwords"
2
2
 
3
3
  namespace :snappconfig do
4
4
 
5
- task :heroku, [:app] => :environment do
5
+ task :heroku do
6
6
  puts "Passing application configuration to Heroku..."
7
7
  merged_yaml = Snappconfig.merged_raw.to_yaml
8
8
  shell_yaml = Shellwords.escape(merged_yaml)
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.3"
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}
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yarin Kessler