acclimate 0.3.0 → 0.4.0
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 +4 -4
- data/lib/acclimate/env.rb +34 -0
- data/lib/acclimate/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f547829447886bc82f248422a3f7421a12971d03
|
4
|
+
data.tar.gz: 5c13d824e7f8e6ac156819f587ddc5ff7483bd2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 479dc2b2260f873061065c8478ccbc99594b2fc7460f9bc21f21e9ecf16d8e42792de651b83fa5f8672b1737438ac1a744879a56f9c876343d07dfe06c96524a
|
7
|
+
data.tar.gz: 85b2897a42c97835b1cf9678a24383803f496db4c4d93ed0b0b1a5db4cfb342cdbfaa432cb494a8f819ece5d95a4055d459b2d760d724403c936d85860019fa9
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module Acclimate
|
4
|
+
class Env
|
5
|
+
|
6
|
+
def initialize( sources )
|
7
|
+
@sources = sources.map { |s| Pathname.new( s ) }
|
8
|
+
end
|
9
|
+
|
10
|
+
def load
|
11
|
+
sources.each do |source|
|
12
|
+
source_env_from( source.expand_path )
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
attr_reader :sources
|
19
|
+
|
20
|
+
def bash_env( cmd=nil )
|
21
|
+
env = `#{cmd + ';' if cmd} printenv`
|
22
|
+
env.split( /\n/ ).map { |l| l.split(/=/) }
|
23
|
+
end
|
24
|
+
|
25
|
+
def bash_source( file )
|
26
|
+
Hash[bash_env(". #{File.realpath file}") - bash_env]
|
27
|
+
end
|
28
|
+
|
29
|
+
def source_env_from( file )
|
30
|
+
bash_source( file ).each { |k,v| ENV[k] = v }
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/lib/acclimate/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acclimate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C. Jason Harrelson (midas )
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- lib/acclimate/command.rb
|
157
157
|
- lib/acclimate/configuration.rb
|
158
158
|
- lib/acclimate/confirmation_error.rb
|
159
|
+
- lib/acclimate/env.rb
|
159
160
|
- lib/acclimate/error.rb
|
160
161
|
- lib/acclimate/formatter.rb
|
161
162
|
- lib/acclimate/output.rb
|