specinfra 2.83.3 → 2.83.4

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: 6705583dbf8312d537307218cb9c75cf28bbb9d6
4
- data.tar.gz: 2fe5613db13e84c37cbce47471cb273907f9cb6c
3
+ metadata.gz: 58cbd695ca792e709adf09757a8b98c9a8ae232e
4
+ data.tar.gz: 6456b8a3ec20b871fec8f2f9213047168ffb2f9d
5
5
  SHA512:
6
- metadata.gz: 94f87c4bbbe61fc61e69d53a81f4b63273c056a9652ad3b86615f466c33c893608a7c7c5ef4df9fdd47747d2a6a5b913bb12d45b1a6c3cab08f8359c8e5ad698
7
- data.tar.gz: 9a28cb42d8c790052039a52b91cb13910addadb0881d8784525e1257ef8f4fe41ae17d2b03de1bbf66381fcac0cd681b3bd9ee85e5ac0cfa281d9cc272590307
6
+ metadata.gz: e4e9801b8d4bf4c504f43e3356240523970e58818f85c0647ed4a2dc2b7e701af323619d270150a0aef349d15dd9f66c3c898d4b0f83ef893d9d078e3593e578
7
+ data.tar.gz: 2d3b11cdf49a821746666230da0980377aaff8e3061e458fdfa76bfc4e5b1ed8d5eba8c19bc886988733f288c436549f7788670216676805cd2c26836e24602f
@@ -17,7 +17,7 @@ module Specinfra
17
17
  @base_image = get_or_pull_image(image)
18
18
 
19
19
  create_and_start_container
20
- ObjectSpace.define_finalizer(self, proc { cleanup_container })
20
+ ObjectSpace.define_finalizer(self, self.class.__send__(:finalizer_for, @container))
21
21
  elsif container = get_config(:docker_container)
22
22
  @container = ::Docker::Container.get(container)
23
23
  else
@@ -25,6 +25,25 @@ module Specinfra
25
25
  end
26
26
  end
27
27
 
28
+ class << self
29
+ protected
30
+
31
+ # Get a finalizer for given container.
32
+ #
33
+ # @param [::Docker::Container, nil] container
34
+ #
35
+ # @return [Proc]
36
+ def finalizer_for(container)
37
+ proc do
38
+ # noinspection RubyNilAnalysis
39
+ unless container.nil?
40
+ container.stop
41
+ container.delete
42
+ end
43
+ end
44
+ end
45
+ end
46
+
28
47
  def run_command(cmd, opts={})
29
48
  cmd = build_command(cmd)
30
49
  run_pre_command(opts)
@@ -77,8 +96,7 @@ module Specinfra
77
96
  end
78
97
 
79
98
  def cleanup_container
80
- @container.stop
81
- @container.delete
99
+ self.class.__send__(:finalizer_for, @container).call
82
100
  end
83
101
 
84
102
  def current_image
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.83.3"
2
+ VERSION = "2.83.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.83.3
4
+ version: 2.83.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-26 00:00:00.000000000 Z
11
+ date: 2022-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp