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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 974bdaf3d34b34590dec398062926a478a99fe49
4
- data.tar.gz: 9f8adcc02d410c9d90d79383d8c4f0f282759eab
3
+ metadata.gz: f547829447886bc82f248422a3f7421a12971d03
4
+ data.tar.gz: 5c13d824e7f8e6ac156819f587ddc5ff7483bd2c
5
5
  SHA512:
6
- metadata.gz: 2dfd82c10e948ba263fd717d02e4bae2b28463e3d2709cc14a5c69291d47bf98bf7de2834ac60241522bbddfa44f4f521caf9b536071dc91bb98e62ae9ffd5e8
7
- data.tar.gz: 74b8613d8cfaaf063253fdcf3d10f8c3fe5f63aadb4f06ca4a8b390832d48382c81c3e65d12c7b0b6603e2c4a4eb2d2b8be02739db5f1bf8e72271d63e21aead
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
@@ -1,3 +1,3 @@
1
1
  module Acclimate
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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