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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4989ba1283405ebd65e60131b8bffc1b7b38ce62
4
- data.tar.gz: 413f7d87a25442b3ed8b6c5f7bd0c9201122c294
3
+ metadata.gz: e38e601ab6c75856b339e10c0316d7b4ba17a4a2
4
+ data.tar.gz: 9c25fb7d7792f4dab457f018c56147d706de8573
5
5
  SHA512:
6
- metadata.gz: 4c40f936b1e32171df69ca28831c5f277e1436247761bb2d9af26a3ac01179422c1c493b4996df5f913013edb8367bfe44fd903156907c1177c877d98cea8431
7
- data.tar.gz: d14f91636bbadce2ba60b2734d33f051381c230692f2eddd24ff1e63fc3224cc95c49e28f6216e8f855d6d4cf10da115f8b72df6a81ff327a43249ada4ad5299
6
+ metadata.gz: 2b7be76159238a601247111c1e5444d67c4677d453d0e4d321b60adb3353678ad6bec969510784657fbfb1894f031dda54d01ec4d8b8aedf118f9076b7095e03
7
+ data.tar.gz: 487a818ad97d4f75785337fe3e0dcb0b7c673f5796f79e2f14105f3012c7da196fab0f9c6ee495638ee71046e0a182da9c19e9012b1b52973f2351cedfa98c47
data/lib/envvy/engine.rb CHANGED
@@ -1,7 +1,10 @@
1
1
  module Envvy
2
+
2
3
  class Engine < ::Rails::Engine
3
4
  initializer 'env-loader.precompile' do |app|
4
5
  app.config.assets.paths << root.join('assets', 'javascripts').to_s
5
6
  end
6
7
  end
8
+
9
+
7
10
  end
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 env_vars
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(env_vars)
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
@@ -1,3 +1,3 @@
1
1
  module Envvy
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envvy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Balaine