env.rb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +6 -4
- data/lib/env/load.rb +2 -0
- data/lib/env/version.rb +1 -1
- data/lib/env.rb +4 -0
- data/spec/import_spec.rb +25 -0
- data/spec/load_spec.rb +4 -2
- metadata +5 -2
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
### Note: I am practicing Readme Driven Development here so don't expect all features to work until 1.0
|
2
|
+
|
1
3
|
# Env.rb
|
2
4
|
Managing your ENVironment
|
3
5
|
|
@@ -40,13 +42,13 @@ your Envfile to a shell-compatible format, and executing scripts within your env
|
|
40
42
|
ENV['HELLO_WORLD'] # => nil
|
41
43
|
Env.enforce
|
42
44
|
ENV['HELLO_WORLD']
|
43
|
-
# => EnvironmentError: HELLO_WORLD is not a declared
|
45
|
+
# => EnvironmentError: HELLO_WORLD is not a declared dependency
|
44
46
|
|
45
47
|
ENV['TEST'] = 'overriding'
|
46
|
-
# => EnvironmentError: TEST is not a declared
|
48
|
+
# => EnvironmentError: TEST is not a declared dependency
|
47
49
|
|
48
|
-
Env.
|
49
|
-
export 'TEXT', '15'
|
50
|
+
Env.instance_eval do
|
51
|
+
export 'TEXT', '15'
|
50
52
|
# same as export 'TEXT', '15', :mutable => false
|
51
53
|
end
|
52
54
|
|
data/lib/env/load.rb
ADDED
data/lib/env/version.rb
CHANGED
data/lib/env.rb
CHANGED
data/spec/import_spec.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative '../lib/env'
|
2
|
+
|
3
|
+
describe Env, 'import' do
|
4
|
+
def envfile(string)
|
5
|
+
File.open("Envfile", 'w') do |f|
|
6
|
+
f << string
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
after { File.unlink('Envfile') }
|
11
|
+
|
12
|
+
context "with an import statement" do
|
13
|
+
before do
|
14
|
+
ENV['FOO'] = 'bar'
|
15
|
+
envfile(%{
|
16
|
+
import 'FOO'
|
17
|
+
})
|
18
|
+
Env.load!
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should use the value in the ENV" do
|
22
|
+
ENV['FOO'].should == 'bar'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/load_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: env.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-09 00:00:00.000000000 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
description: Allows your to manage many ENV vars by declaring them as dependencies
|
@@ -27,8 +27,10 @@ files:
|
|
27
27
|
- Rakefile
|
28
28
|
- env.gemspec
|
29
29
|
- lib/env.rb
|
30
|
+
- lib/env/load.rb
|
30
31
|
- lib/env/version.rb
|
31
32
|
- spec/enforce_spec.rb
|
33
|
+
- spec/import_spec.rb
|
32
34
|
- spec/load_spec.rb
|
33
35
|
- spec/uri_spec.rb
|
34
36
|
has_rdoc: true
|
@@ -58,5 +60,6 @@ specification_version: 3
|
|
58
60
|
summary: Manage your ENV with ease
|
59
61
|
test_files:
|
60
62
|
- spec/enforce_spec.rb
|
63
|
+
- spec/import_spec.rb
|
61
64
|
- spec/load_spec.rb
|
62
65
|
- spec/uri_spec.rb
|