dip 3.4.1 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dip/cli.rb +1 -3
- data/lib/dip/run_vars.rb +27 -17
- data/lib/dip/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b21915c036184db87af0116695d6b54ab3345ded9f3ed9747c01c5dbe454c6d
|
4
|
+
data.tar.gz: 50d05b8888f9636f202873b1c1fe684e312994f25f4d400b1a0c9394b020ff01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc24363f19b3b433efb1602e7e22b641cbca774b2d4bfc6a34cbf5683e4a170065615589e7abc32cba7a3039cc5378a6b96aea381ec95421115594aff01cc3f5
|
7
|
+
data.tar.gz: 9927d87bd8dc6b75a0115e1c363566d5e27e00fd788cbabbe56daff5764870254375f7015b30da2d33645ee695ca3165939bccde8bb5dfc579e7f2b02a363f08
|
data/lib/dip/cli.rb
CHANGED
data/lib/dip/run_vars.rb
CHANGED
@@ -12,42 +12,52 @@ module Dip
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
self.env = {}
|
16
|
+
|
15
17
|
def initialize(argv, env = ENV)
|
16
18
|
@argv = argv
|
17
19
|
@env = env
|
18
|
-
|
20
|
+
|
21
|
+
self.class.env.clear
|
19
22
|
end
|
20
23
|
|
21
24
|
def call
|
22
|
-
|
25
|
+
populate_env_vars
|
26
|
+
parse_argv
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def populate_env_vars
|
32
|
+
return if early_envs.empty?
|
33
|
+
|
34
|
+
(env.keys - early_envs).each do |key|
|
35
|
+
next if env_excluded?(key)
|
36
|
+
|
37
|
+
self.class.env[key] = env[key]
|
38
|
+
end
|
39
|
+
end
|
23
40
|
|
41
|
+
def parse_argv
|
24
42
|
stop_parse = false
|
25
|
-
result_argv = []
|
26
43
|
|
27
|
-
argv.
|
44
|
+
argv.each_with_object([]) do |arg, memo|
|
28
45
|
if !stop_parse && arg.include?("=")
|
29
46
|
key, val = arg.split("=", 2)
|
30
47
|
self.class.env[key] = val
|
31
48
|
else
|
32
|
-
|
49
|
+
memo << arg
|
33
50
|
stop_parse ||= true
|
34
51
|
end
|
35
52
|
end
|
36
|
-
|
37
|
-
result_argv
|
38
53
|
end
|
39
54
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
early_envs = env['DIP_EARLY_ENVS'].to_s
|
44
|
-
return if early_envs.empty?
|
45
|
-
|
46
|
-
(env.keys - early_envs.split(',')).each do |key|
|
47
|
-
next if key.start_with?("DIP_") || key.start_with?("_")
|
55
|
+
def early_envs
|
56
|
+
@early_envs ||= env["DIP_EARLY_ENVS"].to_s.split(",")
|
57
|
+
end
|
48
58
|
|
49
|
-
|
50
|
-
|
59
|
+
def env_excluded?(key)
|
60
|
+
key.start_with?("DIP_", "_")
|
51
61
|
end
|
52
62
|
end
|
53
63
|
end
|
data/lib/dip/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bibendi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|