docker-compose 0.7.0 → 0.8.0

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
  SHA1:
3
- metadata.gz: 76d9302ebcd4e76f964dd3f7b85b65cfe6ab0f22
4
- data.tar.gz: 0d62eabe174c7b93d7a80d120287550e48031457
3
+ metadata.gz: 29ab019002254403adcb4a1ac1eb8f0de9eae404
4
+ data.tar.gz: 3f811096eb9db88a6a258f7d1a3cd52aee1e7b5b
5
5
  SHA512:
6
- metadata.gz: ea304f03ad24a904e99af6ce03241f4553cb05cef8876b508c641cc69e05ff7cf7b055dcb7e8ab599069736f3eb597933d97daa1c8915cdea73b0bf9bc40b102
7
- data.tar.gz: ee9da68c8abe02a2430959bc238c4d79c456da0ae7c7089daf01e5f3db00049afa11f84e597cad3e53b77feae55b9686f00d4c46f1fdeabf0ea56d010cca1c4a
6
+ metadata.gz: 43a2569c8c2b64cda6c1f2d0296429a313220c83c8b4a44aef84e344e99cde89d4293b0386ed5623cd572fc59ec9af2b5c7a3a198f6bf24debcfbe1fe5bb8250
7
+ data.tar.gz: 8dacdec35378f7d22b9c681af9a9411b3617647d4627b54180159b9db0f7139e07f8aac1bca68488211516daff95f061b2d05ed76ae7663e6eb4d58708d177a3
@@ -1,6 +1,11 @@
1
+ # basic smoke test for the gem.
2
+ # TODO: write cucumber features for comprehensive functional tests!
1
3
  apple:
2
4
  image: busybox
3
5
  command: /bin/sh -c 'sleep 3600'
6
+ ports:
7
+ - 123
8
+ - 456
4
9
  orange:
5
10
  image: busybox
6
11
  command: /bin/sh -c 'sleep 3600'
@@ -38,15 +38,22 @@ module Docker::Compose
38
38
  raise Error.new('Service#new', status, 'Unrecognized status') unless status
39
39
  end
40
40
 
41
- names = names.split(',') if names.is_a?(String)
42
- labels = labels.split(',') if labels.is_a?(String)
43
- ports = ports.split(',') if ports.is_a?(String)
41
+ names = names.split(',').map{ |x| x.strip } if names.is_a?(String)
42
+ labels = labels.split(',').map{ |x| x.strip } if labels.is_a?(String)
43
+ ports = ports.split(',').map{ |x| x.strip } if ports.is_a?(String)
44
44
 
45
45
  @id = id
46
46
  @image = image
47
47
  @size = size
48
48
  @status = status[1].downcase.to_sym
49
- @exitstatus = !status[2].empty? && status[2].to_i # sloppy!
49
+
50
+ @exitstatus = case @status
51
+ when :up
52
+ nil
53
+ else
54
+ status[2].to_i
55
+ end
56
+
50
57
  @names = names
51
58
  @labels = labels
52
59
  @ports = ports
@@ -45,7 +45,6 @@ module Docker::Compose
45
45
  inter = @shell.interactive
46
46
  @shell.interactive = false
47
47
 
48
-
49
48
  lines = run!('ps', q:true).split(/[\r\n]+/)
50
49
  containers = Collection.new
51
50
 
@@ -77,8 +76,8 @@ module Docker::Compose
77
76
  true
78
77
  end
79
78
 
80
- def rm(*services, force:false, volumes:false, all:true)
81
- run!('rm', { f: force, v: volumes, a: all }, services)
79
+ def rm(*services, force:false, volumes:false)
80
+ run!('rm', { f: force, v: volumes }, services)
82
81
  end
83
82
 
84
83
  # Idempotently run an arbitrary command with a service container.
@@ -88,13 +87,31 @@ module Docker::Compose
88
87
  # otherwise, monitor logs in the foreground and shutdown on Ctrl+C
89
88
  # @param [Boolean] no_deps if true, just run specified services without
90
89
  # running the services that they depend on
91
- # @param [Array] env_vars a list of environment variables (see: -e flag)
90
+ # @param [Array] env a list of environment variables (see: -e flag)
91
+ # @param [Array] env_vars DEPRECATED alias for env kwarg
92
92
  # @param [Boolean] rm remove the container when done
93
93
  # @raise [Error] if command fails
94
- def run(service, *cmd, detached:false, no_deps:false, env_vars:[], rm:false)
95
- formated_vars = env_vars.map { |v| { e: v } }
94
+ def run(service, *cmd, detached:false, no_deps:false, env:[], env_vars:nil, rm:false)
95
+ # handle deprecated kwarg
96
+ if (env.nil? || env.empty?) && !env_vars.nil?
97
+ env = env_vars
98
+ end
99
+
100
+ env_params = env.map { |v| { e: v } }
96
101
  run!('run',
97
- { d: detached, no_deps: no_deps, rm: rm }, *formated_vars, service, cmd)
102
+ { d: detached, no_deps: no_deps, rm: rm }, *env_params, service, cmd)
103
+ end
104
+
105
+ # Pause running services.
106
+ # @param [Array] services list of String service names to run
107
+ def pause(*services)
108
+ run!('pause', *services)
109
+ end
110
+
111
+ # Unpause running services.
112
+ # @param [Array] services list of String service names to run
113
+ def unpause(*services)
114
+ run!('unpause', *services)
98
115
  end
99
116
 
100
117
  # Stop running services.
@@ -105,6 +122,14 @@ module Docker::Compose
105
122
  run!('stop', { timeout: timeout }, services)
106
123
  end
107
124
 
125
+ # Forcibly stop running services.
126
+ # @param [Array] services list of String service names to stop
127
+ # @param [String] name of murderous signal to use, default is 'KILL'
128
+ # @see Signal.list for a list of acceptable signal names
129
+ def kill(*services, signal:'KILL')
130
+ run!('kill', { s: signal }, services)
131
+ end
132
+
108
133
  # Figure out which host a port a given service port has been published to.
109
134
  # @param [String] service name of service from docker-compose.yml
110
135
  # @param [Integer] port number of port
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Docker
3
3
  module Compose
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.0'
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: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Spataro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-04 00:00:00.000000000 Z
11
+ date: 2016-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backticks