snappconfig 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/snappconfig/railtie.rb +14 -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: 14eb983b17f43b7bb6f16c65df5a8595ca02de9f
|
4
|
+
data.tar.gz: 2bd84af7c8bb5d396dd709fe79c7334140a5912d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1135507a51adfd8544ec0cbba1b053626253f9e2a1fffd4c2b5663287246190ff6c4af99d22be5935aca389700fe3323a55d2cc43be2c53cb121a966004b5693
|
7
|
+
data.tar.gz: 500ed4fd39889e499f93f310564913babdddb30b957a028afaa328e73f8715f60bb51f526f5e17500efc5840898548e0450d2b9a0378e09102089119520f0c06
|
data/README.md
CHANGED
@@ -125,7 +125,7 @@ For instance, if we already have a mailer configuration that works for our app,
|
|
125
125
|
|
126
126
|
Using the `_REQUIRED` keyword, we indicate values we expect to be included in the configuration, even though they're not in this file.
|
127
127
|
|
128
|
-
We can then
|
128
|
+
We can then fill in those values with a git-ignored file that only stores our secrets:
|
129
129
|
|
130
130
|
**application.secrets.yml:**
|
131
131
|
|
@@ -134,7 +134,7 @@ We can then fulfill that obligation by using a git-ignored file that just stores
|
|
134
134
|
smtp_settings:
|
135
135
|
password: 8675309
|
136
136
|
|
137
|
-
|
137
|
+
And there it is- configuration without compromise!
|
138
138
|
|
139
139
|
The `_REQUIRED` keyword is really handy. You can use it to stub out an entire config file template. If any of the required values are not present at runtime Snappconfig will raise an error, ensuring you never go live without a complete configuration.
|
140
140
|
|
data/lib/snappconfig/railtie.rb
CHANGED
@@ -6,33 +6,28 @@ 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
9
|
|
13
|
-
|
14
|
-
|
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.deep_dup
|
15
12
|
|
16
|
-
|
17
|
-
|
13
|
+
appconfig.deep_merge! appconfig.fetch('defaults', {})
|
14
|
+
appconfig.deep_merge! appconfig.fetch(Rails.env, {})
|
18
15
|
|
19
|
-
|
16
|
+
Snappconfig.environments.each { |environment| appconfig.delete(environment) }
|
20
17
|
|
21
|
-
|
18
|
+
check_required(appconfig)
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
appconfig.delete('ENV')
|
20
|
+
# Assign ENV values and then delete them from CONFIG so we don't have duplicate data:
|
21
|
+
if appconfig.has_key?('ENV')
|
22
|
+
appconfig['ENV'].each do |key, value|
|
23
|
+
ENV[key] = value.to_s unless value.kind_of? Hash
|
29
24
|
end
|
30
|
-
|
31
|
-
appconfig = recursively_symbolize_keys(appconfig)
|
32
|
-
CONFIG.merge! appconfig
|
33
|
-
|
25
|
+
appconfig.delete('ENV')
|
34
26
|
end
|
35
27
|
|
28
|
+
appconfig = recursively_symbolize_keys(appconfig)
|
29
|
+
CONFIG.merge! appconfig
|
30
|
+
|
36
31
|
end
|
37
32
|
|
38
33
|
rake_tasks do
|
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.7"
|
8
8
|
spec.authors = ["Yarin Kessler"]
|
9
9
|
spec.email = "ykessler@appgrinders.com"
|
10
10
|
spec.summary = %q{Smarter Rails configuration with YAML}
|