env_vars 0.2.0 → 0.3.0

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: 28f7bbf699affb4b23e6c9abcaaefb143b325986
4
- data.tar.gz: a9fc258b62f95ba09e1a4b35ceb9c6d11ff35589
3
+ metadata.gz: 5ca734fa7ce7864c0c4466e9f49386731c1dcec1
4
+ data.tar.gz: 85a5fe9f76d385ca5a26af5da8be69989b57aa66
5
5
  SHA512:
6
- metadata.gz: d27a2dbe351556de1ddfe61331460bf8cf5c91a0267bc83821a910de1cd6b74421b29d4098eaf9c0c5545bbf630096d083c31523ff1e3a764c0af7b03a39a2c6
7
- data.tar.gz: 4dfd76afcf2eb77768e0369acdb4a8b80b16b1ebeb4487c229a9c7e5c210f37666fdf225408aa5e2c2161515c4095585b39d44a395f21d5d0cd893e335de7e12
6
+ metadata.gz: a012b983335eeacda67793fb5f9cad7126f229d0f3d9dd43df6b0ef7b2b791130b35ee3bdce28669190bad7e09033f47a77eadc06904ba8c1f36a2e1d4b16cba
7
+ data.tar.gz: f7c2040a92c635adb5d0ded62bbcba949b7fc48cdf4a41191d238b4a2a1a5409fab11114f662f054201e1905c91ab35b73a41cc11426057ea82c202d702eeccb
data/README.md CHANGED
@@ -9,7 +9,7 @@ Access environment variables. Also includes presence validation, type coercion a
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'env_vars'
12
+ gem "env_vars"
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -27,7 +27,7 @@ Config = Env::Vars.new do
27
27
  mandatory :database_url, string
28
28
  optional :timeout, int, 10
29
29
  optional :force_ssl, bool, false
30
- optional :rails_env, 'development', string, aliases: %w[env]
30
+ optional :rails_env, "development", string, aliases: %w[env]
31
31
  end
32
32
 
33
33
  Config.database_url
@@ -35,10 +35,25 @@ Config.timeout
35
35
  Config.force_ssl?
36
36
  ```
37
37
 
38
- If you're using [dotenv](https://rubygems.org/gems/dotenv), you can simply require `env_vars/dotenv`. This will load environment variables from `.env.local`, `.env.%{environment}` and `.env` files. You _must_ add `dotenv` to your `Gemfile`.
38
+ If you're using [dotenv](https://rubygems.org/gems/dotenv), you can simply require `env_vars/dotenv`. This will load environment variables from `.env.local.%{environment}`, `.env.local`, `.env.%{environment}` and `.env` files, respectively. You _must_ add `dotenv` to your `Gemfile`.
39
39
 
40
40
  ```ruby
41
- require 'env_vars/dotenv'
41
+ require "env_vars/dotenv"
42
+ ```
43
+
44
+ ### Configuring Rails
45
+
46
+ If you want to use `env_vars` even on your Rails configuration files like `database.yml` and `secrets.yml`, you must load it from `config/boot.rb`, right after setting up Bundler.
47
+
48
+ ```ruby
49
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
50
+
51
+ # Set up gems listed in the Gemfile.
52
+ require "bundler/setup"
53
+
54
+ # Load configuration.
55
+ require "env_vars/dotenv"
56
+ require File.expand_path("../config", __FILE__)
42
57
  ```
43
58
 
44
59
  ## Development
@@ -55,4 +70,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/fnando
55
70
  ## License
56
71
 
57
72
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
58
-
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require "rake/testtask"
4
4
  Rake::TestTask.new(:test) do |t|
5
5
  t.libs << "test"
6
6
  t.libs << "lib"
7
- t.test_files = FileList['test/**/*_test.rb']
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
8
  end
9
9
 
10
10
  task :default => :test
data/env_vars.gemspec CHANGED
@@ -1,22 +1,22 @@
1
- require File.expand_path('../lib/env_vars', __FILE__)
1
+ require File.expand_path("../lib/env_vars", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |spec|
4
- spec.name = 'env_vars'
4
+ spec.name = "env_vars"
5
5
  spec.version = Env::Vars::VERSION
6
- spec.authors = ['Nando Vieira']
7
- spec.email = ['fnando.vieira@gmail.com']
6
+ spec.authors = ["Nando Vieira"]
7
+ spec.email = ["fnando.vieira@gmail.com"]
8
8
 
9
- spec.summary = 'Access environment variables. Also includes presence validation, type coercion and default values.'
9
+ spec.summary = "Access environment variables. Also includes presence validation, type coercion and default values."
10
10
  spec.description = spec.summary
11
- spec.homepage = 'https://github.com/fnando/env_vars'
12
- spec.license = 'MIT'
11
+ spec.homepage = "https://github.com/fnando/env_vars"
12
+ spec.license = "MIT"
13
13
 
14
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
- spec.require_paths = ['lib']
14
+ spec.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
15
+ spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
16
+ spec.require_paths = ["lib"]
17
17
 
18
- spec.add_development_dependency 'bundler', '~> 1.10'
19
- spec.add_development_dependency 'rake', '~> 10.0'
20
- spec.add_development_dependency 'minitest'
21
- spec.add_development_dependency 'minitest-utils'
18
+ spec.add_development_dependency "bundler", "~> 1.10"
19
+ spec.add_development_dependency "rake", "~> 10.0"
20
+ spec.add_development_dependency "minitest"
21
+ spec.add_development_dependency "minitest-utils"
22
22
  end
@@ -1,5 +1,5 @@
1
- require 'env_vars'
2
- require 'dotenv'
1
+ require "env_vars"
2
+ require "dotenv"
3
3
 
4
- env = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
5
- Dotenv.load '.env.local', ".env.#{env}", '.env'
4
+ env = ENV["RACK_ENV"] || ENV["RAILS_ENV"] || "development"
5
+ Dotenv.load ".env.local.#{env}", ".env.local", ".env.#{env}", ".env"
data/lib/env_vars.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Env
2
2
  class Vars
3
- VERSION = '0.2.0'
4
- BOOL_TRUE = ['yes', 'true', '1', true]
5
- BOOL_FALSE = ['no', 'false']
3
+ VERSION = "0.3.0"
4
+ BOOL_TRUE = ["yes", "true", "1", true]
5
+ BOOL_FALSE = ["no", "false"]
6
6
 
7
7
  MissingEnvironmentVariable = Class.new(StandardError)
8
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env_vars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-08 00:00:00.000000000 Z
11
+ date: 2015-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.4.5.1
107
+ rubygems_version: 2.5.0
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Access environment variables. Also includes presence validation, type coercion