docker-compose 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/docker/compose/session.rb +14 -5
- data/lib/docker/compose/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: b9be484af8c4f5250961c4df03f04aaceebd7fd2
|
4
|
+
data.tar.gz: a16663183f5a512c9344ad2110fba19179f1a339
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6eb3ed59f86318bbced3d41196924d7c1588f65d367dbbc4f9bd03d4b9524a53d599ba34b142e0b2c779cb94b74c0ecd8657bcfec8d77f43c67872b9e303997
|
7
|
+
data.tar.gz: 8998e342c4af0c810c073cd49dab423e451ad95ed9471e58c4687181a3a59f5e50227ee6a118bbba367584fa8c5d053f59697e369101772644ce413378958fdf
|
@@ -15,6 +15,9 @@ module Docker::Compose
|
|
15
15
|
# allowed by the docker-compose CLI, and that options are sometimes renamed
|
16
16
|
# for clarity, e.g. the "-d" flag always becomes the "detached:" kwarg.
|
17
17
|
class Session
|
18
|
+
# A Regex that matches all ANSI escape sequences.
|
19
|
+
ANSI = /\033\[([0-9];?)+[a-z]/
|
20
|
+
|
18
21
|
# Working directory (determines compose project name); default is Dir.pwd
|
19
22
|
attr_reader :dir
|
20
23
|
|
@@ -53,7 +56,7 @@ module Docker::Compose
|
|
53
56
|
containers = Collection.new
|
54
57
|
|
55
58
|
lines.each do |id|
|
56
|
-
containers << docker_ps(id)
|
59
|
+
containers << docker_ps(strip_ansi(id))
|
57
60
|
end
|
58
61
|
|
59
62
|
containers
|
@@ -171,7 +174,7 @@ module Docker::Compose
|
|
171
174
|
@shell.interactive = false
|
172
175
|
|
173
176
|
o = opts(protocol: [protocol, 'tcp'], index: [index, 1])
|
174
|
-
s = run!('port', o, service, port).strip
|
177
|
+
s = strip_ansi(run!('port', o, service, port).strip)
|
175
178
|
(!s.empty? && s) || nil
|
176
179
|
ensure
|
177
180
|
@shell.interactive = inter
|
@@ -241,16 +244,17 @@ module Docker::Compose
|
|
241
244
|
def docker_ps(id)
|
242
245
|
cmd = @shell.run('docker', 'ps', a: true, f: "id=#{id}", format: Container::PS_FMT).join
|
243
246
|
status, out, err = cmd.status, cmd.captured_output, cmd.captured_error
|
244
|
-
raise Error.new('docker ps', status,
|
247
|
+
raise Error.new('docker ps', status, out+err) unless status.success?
|
245
248
|
lines = out.split(/[\r\n]+/)
|
246
249
|
return nil if lines.empty?
|
247
|
-
l = lines.shift
|
250
|
+
l = strip_ansi(lines.shift)
|
248
251
|
m = parse(l)
|
249
252
|
raise Error.new('docker ps', status, "Cannot parse output: '#{l}'") unless m
|
253
|
+
raise Error.new('docker ps', status, "Cannot parse output: '#{l}'") unless m.size == 7
|
250
254
|
return Container.new(*m)
|
251
255
|
end
|
252
256
|
|
253
|
-
# strip default-
|
257
|
+
# strip default-valued options. the value of each kw should be a pair:
|
254
258
|
# [0] is present value
|
255
259
|
# [1] is default value
|
256
260
|
def opts(**kws)
|
@@ -261,6 +265,11 @@ module Docker::Compose
|
|
261
265
|
res
|
262
266
|
end
|
263
267
|
|
268
|
+
# strip all ANSI escape sequences from str
|
269
|
+
def strip_ansi(str)
|
270
|
+
str.gsub(ANSI, '')
|
271
|
+
end
|
272
|
+
|
264
273
|
# parse values enclosed within parentheses; values may contain nested
|
265
274
|
# matching pairs of parentheses
|
266
275
|
def parse(str)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker-compose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Spataro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backticks
|