specinfra 2.83.3 → 2.83.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/specinfra/backend/docker.rb +21 -3
- data/lib/specinfra/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58cbd695ca792e709adf09757a8b98c9a8ae232e
|
4
|
+
data.tar.gz: 6456b8a3ec20b871fec8f2f9213047168ffb2f9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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.
|
81
|
-
@container.delete
|
99
|
+
self.class.__send__(:finalizer_for, @container).call
|
82
100
|
end
|
83
101
|
|
84
102
|
def current_image
|
data/lib/specinfra/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2022-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|