docker-compose 1.1.4 → 1.1.5

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: 0e34ae573ca7de8849b4abec1d2a64e310d9aeb1
4
- data.tar.gz: ba3fc1a5c2853685a53b4e197554aa549be1a25b
3
+ metadata.gz: 478beb29d6142fc515826e1aa6e14962dd7b35b9
4
+ data.tar.gz: 814a525fa49f283e11c88833e7c567045562aa3d
5
5
  SHA512:
6
- metadata.gz: 7d20035a66e70117ef15c1e6de3b4462178add5f8b5f6d11d46aff985f05aa8e675443b588784e07a06d3b76779a25b33268cbb3441ec6519cd94bfa3cc8d5b6
7
- data.tar.gz: c5f1e12aa81b3bf0921746de8c361226e30aaed310333a0441f79adeef7d7cfc2ea95c8a61e1aa2fca8bbff50d4da60697063fc0c035d92d822eaa7c3632f74e
6
+ metadata.gz: 27fbfc9b939b33b8a6c5435049342ab073c34c1ca80dae8b6ccaa139789286fe812d9c529029914f5d568bdfd92478a200e3e235f13ff0fd6b75b666e00179e2
7
+ data.tar.gz: c8a10bd86422094fad06353303c817c7d0633c5218dbd073cff769f93899bcc4a88626370f90ad7de7b312afe97a25836d2f4a98baa2b719d77f9c59b272b8e0
@@ -6,27 +6,30 @@ module Docker::Compose
6
6
  PS_FMT_LEN = PS_FMT.count('.')
7
7
  # Pattern that parses human-readable values from ps .Status
8
8
  PS_STATUS = /^([A-Za-z]+) ?\(?([0-9]*)\)? ?(.*)$/i
9
+ # Pattern that parses FIRST occurrence of container size from a string,
10
+ # along with its units.
11
+ PS_SIZE = /^([0-9.]+)\s*([kmgt]?B)/i
9
12
 
10
13
  attr_reader :id, :image, :size, :status, :exitstatus
11
14
  attr_reader :names, :labels, :ports
12
15
 
13
16
  # @param [String] id
14
17
  # @param [String] image
15
- # @param [String,Numeric] size
18
+ # @param [String,Integer] size e.g. "0B (virtual 100MB)"
16
19
  # @param [String,#map] status e.g. ['Exited', '0', '3 minutes ago']
17
20
  # @param [String,Array] names list of container names (CSV)
18
21
  # @param [String,Array] labels list of container labels (CSV)
19
22
  # @param [String,Array] ports list of exposed ports (CSV)
20
23
  def initialize(id, image, size, status, names, labels, ports)
21
- if size.is_a?(String)
22
- scalar, units = size.split(' ')
23
- scalar = size[0].to_i # lazy: invalid --> 0
24
+ if size.is_a?(String) && (m = PS_SIZE.match(size))
25
+ scalar, units = m[1], m[2]
26
+ scalar = scalar.to_f # lazy: invalid --> 0.0
24
27
  mult = case units.downcase
25
28
  when 'b' then 1
26
29
  when 'kb' then 1_024
27
- when 'mb' then 1_024^2
28
- when 'gb' then 1_024^3
29
- when 'tb' then 1_024^4
30
+ when 'mb' then 1_024**2
31
+ when 'gb' then 1_024**3
32
+ when 'tb' then 1_024**4
30
33
  else
31
34
  raise Error.new('Service#new', units, 'Impossibly large unit')
32
35
  end
@@ -60,8 +63,8 @@ module Docker::Compose
60
63
  end
61
64
 
62
65
  # static sanity checking ftw!
63
- unless ( initarity = instance_method(:initialize).arity ) == ( psfmtcnt = PS_FMT.count('.') )
64
- raise LoadError.new("#{__FILE__}:#{__LINE__} - arity(\#initialize) != len(PS_FMT); #{initarity} != #{psfmtcnt}")
66
+ unless ( initarity = instance_method(:initialize).arity ) == PS_FMT_LEN
67
+ raise LoadError.new("#{__FILE__}:#{__LINE__} - arity(\#initialize) != PS_FMT_LEN; #{initarity} != #{PS_FMT_LEN}")
65
68
  end
66
69
 
67
70
  # @return [String]
@@ -288,8 +288,11 @@ module Docker::Compose
288
288
  str.gsub(ANSI, '')
289
289
  end
290
290
 
291
- # parse values enclosed within parentheses; values may contain nested
292
- # matching pairs of parentheses
291
+ # Parse a string that consists of a sequence of values enclosed within parentheses.
292
+ # Ignore any bytes that are outside of parentheses. Values may include nested parentheses.
293
+ #
294
+ # @param [String] str e.g. "(foo) ((bar)) ... (baz)"
295
+ # @return [Array] e.g. ["foo", "bar", "baz"]
293
296
  def parse(str)
294
297
  fields = []
295
298
  nest = 0
@@ -303,6 +306,7 @@ module Docker::Compose
303
306
  else
304
307
  if ch == '('
305
308
  nest += 1
309
+ field << ch
306
310
  elsif ch == ')'
307
311
  nest -= 1
308
312
  if nest == 0
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Docker
3
3
  module Compose
4
- VERSION = '1.1.4'
4
+ VERSION = '1.1.5'
5
5
  end
6
6
  end
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.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Spataro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-29 00:00:00.000000000 Z
11
+ date: 2017-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backticks