dotenv 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/dotenv.gemspec +1 -1
- data/lib/dotenv.rb +1 -1
- data/lib/dotenv/environment.rb +1 -1
- data/spec/dotenv_spec.rb +29 -9
- metadata +4 -4
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# dotenv
|
2
2
|
|
3
|
-
Loads environment
|
3
|
+
Loads environment variables from `.env` into `ENV`, automagically.
|
4
4
|
|
5
|
-
|
5
|
+
Read more about the [motivation for dotenv at opensoul.org](http://opensoul.org/blog/archives/2012/07/24/dotenv/).
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
data/dotenv.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.name = "dotenv"
|
14
14
|
gem.require_paths = ["lib"]
|
15
|
-
gem.version = '0.1.
|
15
|
+
gem.version = '0.1.1'
|
16
16
|
|
17
17
|
gem.add_development_dependency 'rake'
|
18
18
|
gem.add_development_dependency 'rspec'
|
data/lib/dotenv.rb
CHANGED
data/lib/dotenv/environment.rb
CHANGED
data/spec/dotenv_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Dotenv::Environment do
|
4
|
-
let(:env_path) { fixture_path('plain.env') }
|
5
4
|
let(:dotenv) { Dotenv::Environment.new(env_path) }
|
6
5
|
|
7
6
|
before do
|
@@ -12,17 +11,38 @@ describe Dotenv::Environment do
|
|
12
11
|
ENV.delete_if { |k,v| !@env_keys.include?(k) }
|
13
12
|
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
context 'with a plain env file' do
|
15
|
+
let(:env_path) { fixture_path('plain.env') }
|
16
|
+
|
17
|
+
describe 'initialize' do
|
18
|
+
it 'reads environment config' do
|
19
|
+
expect(dotenv['OPTION_A']).to eq('1')
|
20
|
+
expect(dotenv['OPTION_B']).to eq('2')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'apply' do
|
25
|
+
it 'sets variables in ENV' do
|
26
|
+
dotenv.apply
|
27
|
+
expect(ENV['OPTION_A']).to eq('1')
|
28
|
+
end
|
19
29
|
end
|
20
30
|
end
|
21
31
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
32
|
+
context 'when the file does not exist' do
|
33
|
+
let(:env_path) { fixture_path('.env_does_not_exist') }
|
34
|
+
|
35
|
+
describe 'initialize' do
|
36
|
+
it 'fails silently' do
|
37
|
+
lambda { Dotenv::Environment.new('.env_does_not_exist') }.should_not raise_error
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'apply' do
|
42
|
+
it 'does not effect env' do
|
43
|
+
dotenv.apply
|
44
|
+
expect(ENV.keys).to eq(@env_keys)
|
45
|
+
end
|
26
46
|
end
|
27
47
|
end
|
28
48
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotenv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brandon Keepers
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-08-08 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|