envvy 1.0.2 → 1.0.3
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 +4 -4
- data/lib/envvy/engine.rb +3 -0
- data/lib/envvy/railtie.rb +11 -4
- data/lib/envvy/version.rb +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: e38e601ab6c75856b339e10c0316d7b4ba17a4a2
|
4
|
+
data.tar.gz: 9c25fb7d7792f4dab457f018c56147d706de8573
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b7be76159238a601247111c1e5444d67c4677d453d0e4d321b60adb3353678ad6bec969510784657fbfb1894f031dda54d01ec4d8b8aedf118f9076b7095e03
|
7
|
+
data.tar.gz: 487a818ad97d4f75785337fe3e0dcb0b7c673f5796f79e2f14105f3012c7da196fab0f9c6ee495638ee71046e0a182da9c19e9012b1b52973f2351cedfa98c47
|
data/lib/envvy/engine.rb
CHANGED
data/lib/envvy/railtie.rb
CHANGED
@@ -4,6 +4,14 @@ module Envvy
|
|
4
4
|
class Railtie < Rails::Railtie
|
5
5
|
attr_accessor :env
|
6
6
|
|
7
|
+
class << self
|
8
|
+
attr_accessor :config_path
|
9
|
+
|
10
|
+
def config_path
|
11
|
+
@config_path || File.join(Rails.root, "config", "env_vars.yml")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
7
15
|
config.before_initialize do
|
8
16
|
self.get("config") do |config|
|
9
17
|
config.each do |k, v|
|
@@ -13,14 +21,13 @@ module Envvy
|
|
13
21
|
end
|
14
22
|
|
15
23
|
config.before_configuration do
|
16
|
-
env_vars = File.join(Rails.root, "config", "env_vars.yml")
|
17
24
|
|
18
|
-
set_env
|
25
|
+
set_env self.config_path
|
19
26
|
|
20
27
|
if Rails.env.development?
|
21
28
|
require 'filewatch/watch'
|
22
29
|
conf_watcher = FileWatch::Watch.new
|
23
|
-
conf_watcher.watch(
|
30
|
+
conf_watcher.watch(self.config_path)
|
24
31
|
|
25
32
|
Thread.new do
|
26
33
|
conf_watcher.subscribe(1,5) do |status, path|
|
@@ -31,7 +38,7 @@ module Envvy
|
|
31
38
|
end
|
32
39
|
|
33
40
|
def set_env file
|
34
|
-
self.env = YAML.load(File.read(file))
|
41
|
+
self.env = if File.exist?(file) then YAML.load(File.read(file)) else {} end
|
35
42
|
end
|
36
43
|
|
37
44
|
def get(key, &block)
|
data/lib/envvy/version.rb
CHANGED