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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f20dbfd7641a1820ae40df24486eb9a5c406263dd4e6505a180dc9c608907162
4
- data.tar.gz: 28fc371a9a4f953d5f6beb06d023ea63e7feb94ec7c68559f134a86c369c2276
3
+ metadata.gz: 6b21915c036184db87af0116695d6b54ab3345ded9f3ed9747c01c5dbe454c6d
4
+ data.tar.gz: 50d05b8888f9636f202873b1c1fe684e312994f25f4d400b1a0c9394b020ff01
5
5
  SHA512:
6
- metadata.gz: 6a681f1c2a369f362360e94e6535e8df78cedc62d146d78fe6b7d65ecd901c366618faec79f74504aa17511a6ec28d29cb8f367296f653a4eed7506ef1162e3d
7
- data.tar.gz: 48e7d213640ab4aaf879918e3a3600e8c06c1026e870a1a2c881447dfc5d48e93a25dcb63965ee47823049eda32cfb8655d60fd5e1fe2c460428269394a7cf87
6
+ metadata.gz: cc24363f19b3b433efb1602e7e22b641cbca774b2d4bfc6a34cbf5683e4a170065615589e7abc32cba7a3039cc5378a6b96aea381ec95421115594aff01cc3f5
7
+ data.tar.gz: 9927d87bd8dc6b75a0115e1c363566d5e27e00fd788cbabbe56daff5764870254375f7015b30da2d33645ee695ca3165939bccde8bb5dfc579e7f2b02a363f08
@@ -21,9 +21,7 @@ module Dip
21
21
 
22
22
  def method_missing(cmd, *args)
23
23
  if Dip.config.interaction.key?(cmd.to_sym)
24
- args.unshift(cmd.to_s)
25
- args.unshift("run")
26
- self.class.start(args)
24
+ self.class.start(["run", cmd] + args)
27
25
  else
28
26
  super
29
27
  end
@@ -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
- self.class.env = {}
20
+
21
+ self.class.env.clear
19
22
  end
20
23
 
21
24
  def call
22
- extract_new_env_vars
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.each do |arg|
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
- result_argv << arg
49
+ memo << arg
33
50
  stop_parse ||= true
34
51
  end
35
52
  end
36
-
37
- result_argv
38
53
  end
39
54
 
40
- private
41
-
42
- def extract_new_env_vars
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
- self.class.env[key] = env[key]
50
- end
59
+ def env_excluded?(key)
60
+ key.start_with?("DIP_", "_")
51
61
  end
52
62
  end
53
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dip
4
- VERSION = "3.4.1"
4
+ VERSION = "3.4.2"
5
5
  end
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.1
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-13 00:00:00.000000000 Z
11
+ date: 2018-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor