starenv 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/starenv/environment.rb +10 -2
- data/lib/starenv/file/node.rb +9 -5
- data/starenv.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f62c737f6641cc377942b154fa174a519839e523
|
4
|
+
data.tar.gz: 8702d7433c99c1037320c1b6fc1ab50c964e1849
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ead64a5864fefa2c6659ced490b2f57b624252b119099286632434450a6704b1fab68fad081aa32bf5970d9413cbdf1473d5c4911fcdfad52a118329f10c2604
|
7
|
+
data.tar.gz: 1886d2735b635cf18ca05fa9a3102db31da3bd0b6da49da12ff68efc7dbbffa2d68f920188e2ff63dc93283194764f04f3f1c01a497e43077afb6240baebf661
|
data/.gitignore
CHANGED
data/lib/starenv/environment.rb
CHANGED
@@ -7,7 +7,7 @@ module Starenv
|
|
7
7
|
|
8
8
|
def initialize(source = nil)
|
9
9
|
@source = source ? source : ENV
|
10
|
-
@variables, @applied, @ignored = {}
|
10
|
+
@variables, @applied, @ignored = {}, {}, {}
|
11
11
|
end
|
12
12
|
|
13
13
|
def [] key
|
@@ -22,10 +22,18 @@ module Starenv
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def has_key?(key)
|
26
|
+
self[key] and not self[key].to_s.empty?
|
27
|
+
end
|
28
|
+
|
25
29
|
def apply(hash)
|
26
30
|
self.tap do |env|
|
27
31
|
hash.each do |key, value|
|
28
|
-
|
32
|
+
if has_key? key
|
33
|
+
@ignored[key] = value
|
34
|
+
else
|
35
|
+
self[key], @applied[key] = value, value
|
36
|
+
end
|
29
37
|
end
|
30
38
|
end
|
31
39
|
end
|
data/lib/starenv/file/node.rb
CHANGED
@@ -12,16 +12,20 @@ module Starenv
|
|
12
12
|
|
13
13
|
def load
|
14
14
|
tap do
|
15
|
-
unless loaded?
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
load! unless loaded?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def load!
|
20
|
+
tap do
|
21
|
+
@environment = (hook || default_hook).call self do
|
22
|
+
File.parse(name).environment
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
23
27
|
def loaded?
|
24
|
-
|
28
|
+
!!@environment
|
25
29
|
end
|
26
30
|
|
27
31
|
private
|
data/starenv.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "starenv"
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.2'
|
8
8
|
spec.authors = ["Chris Keele"]
|
9
9
|
spec.email = ["dev@chriskeele.com"]
|
10
10
|
spec.summary = 'Load and manage suites of environment variables.'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: starenv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Keele
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|