docker-compose 1.1.10 → 1.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +7 -4
- data/.ruby-version +1 -2
- data/.travis.yml +2 -0
- data/Gemfile +2 -0
- data/docker-compose.gemspec +2 -2
- data/lib/docker/compose/rake_tasks.rb +14 -4
- data/lib/docker/compose/session.rb +21 -8
- data/lib/docker/compose/version.rb +1 -1
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e6262f4b5327a6262a8ce2444095d7e8ef3d146d1c51a8274bfd630316283319
|
4
|
+
data.tar.gz: 1c55d47ce905b4bd05e107c14e5526aa4639eea8855e9fe570b55baacc5db078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e32beed052983ef9da71bc0e2fbb34cdf7f91933f4a711f2afe601087832e449d2a09ca487534d2e23f2206eb5e2c3d49baccceb1d421347037d3afa6fbb0a7b
|
7
|
+
data.tar.gz: ce78f94fd2d0a4c6a35f39edfe6d4a93423df3126036ee4bd16d037d5b26f403e2b5609cc0c408858ec3cc4bd4e1acc8dc2853b469bea7cdff16a6db712b6feb
|
data/.rubocop.yml
CHANGED
@@ -2,22 +2,25 @@
|
|
2
2
|
# - any cop that can be auto-corrected with `rubocop -a` is mandatory
|
3
3
|
# - other cops may be enabled if committer fixes all issues
|
4
4
|
AllCops:
|
5
|
+
NewCops: enable
|
5
6
|
Exclude:
|
6
|
-
|
7
|
-
|
7
|
+
- features/**/*
|
8
|
+
- spec/**/*
|
8
9
|
Style/Encoding:
|
9
10
|
Enabled: true
|
10
11
|
Style/FormatString:
|
11
12
|
Enabled: false
|
12
13
|
Style/GuardClause:
|
13
14
|
Enabled: false
|
15
|
+
Layout/LineLength:
|
16
|
+
Enabled: false
|
14
17
|
Lint/AmbiguousRegexpLiteral:
|
15
18
|
Enabled: false
|
16
19
|
Metrics/AbcSize:
|
17
20
|
Enabled: false
|
18
|
-
Metrics/
|
21
|
+
Metrics/BlockLength:
|
19
22
|
Enabled: false
|
20
|
-
Metrics/
|
23
|
+
Metrics/ClassLength:
|
21
24
|
Enabled: false
|
22
25
|
Metrics/MethodLength:
|
23
26
|
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
3.0.0
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/docker-compose.gemspec
CHANGED
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.required_ruby_version = Gem::Requirement.new('
|
22
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.0', '< 4.0')
|
23
23
|
|
24
24
|
spec.add_dependency 'backticks', '~> 1.0'
|
25
25
|
|
26
|
-
spec.add_development_dependency 'bundler', '~>
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
27
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
28
28
|
spec.add_development_dependency 'rspec'
|
29
29
|
end
|
@@ -17,6 +17,10 @@ module Docker::Compose
|
|
17
17
|
# @return [String]
|
18
18
|
attr_accessor :dir
|
19
19
|
|
20
|
+
# Set the project name. Default is not to pass a custom name.
|
21
|
+
# @return [String]
|
22
|
+
attr_accessor :project_name
|
23
|
+
|
20
24
|
# Set the name of the docker-compose file. Default is`docker-compose.yml`.
|
21
25
|
# @return [String]
|
22
26
|
attr_accessor :file
|
@@ -57,6 +61,7 @@ module Docker::Compose
|
|
57
61
|
# can be configured by calling #server_env=, #file= and so forth.
|
58
62
|
def initialize
|
59
63
|
self.dir = Rake.application.original_dir
|
64
|
+
self.project_name = nil
|
60
65
|
self.file = 'docker-compose.yml'
|
61
66
|
self.host_env = {}
|
62
67
|
self.extra_host_env = {}
|
@@ -64,7 +69,7 @@ module Docker::Compose
|
|
64
69
|
yield self if block_given?
|
65
70
|
|
66
71
|
@shell = Backticks::Runner.new
|
67
|
-
@session = Docker::Compose::Session.new(@shell, dir: dir, file: file)
|
72
|
+
@session = Docker::Compose::Session.new(@shell, dir: dir, project_name: project_name, file: file)
|
68
73
|
@net_info = Docker::Compose::NetInfo.new
|
69
74
|
@shell_printer = Docker::Compose::ShellPrinter.new
|
70
75
|
|
@@ -80,7 +85,7 @@ module Docker::Compose
|
|
80
85
|
@shell.interactive = false # suppress useless 'port' output
|
81
86
|
|
82
87
|
tty = STDOUT.tty?
|
83
|
-
tlt = Rake.application.top_level_tasks.include?('
|
88
|
+
tlt = Rake.application.top_level_tasks.include?(task_name('env'))
|
84
89
|
|
85
90
|
# user invoked this task directly; print some helpful tips on
|
86
91
|
# how we intend it to be used.
|
@@ -92,7 +97,7 @@ module Docker::Compose
|
|
92
97
|
end
|
93
98
|
|
94
99
|
desc 'Run command on host, linked to services in containers'
|
95
|
-
task :host, [:command] => ['
|
100
|
+
task :host, [:command] => [task_name('env')] do |_task, args|
|
96
101
|
if host_services
|
97
102
|
@session.up(*host_services, detached: true)
|
98
103
|
else
|
@@ -151,11 +156,16 @@ module Docker::Compose
|
|
151
156
|
private :print_env
|
152
157
|
|
153
158
|
def print_usage
|
154
|
-
command = "rake #{
|
159
|
+
command = "rake #{task_name('env')}"
|
155
160
|
command = 'bundle exec ' + command if defined?(Bundler)
|
156
161
|
puts @shell_printer.comment('To export these variables to your shell, run:')
|
157
162
|
puts @shell_printer.comment(@shell_printer.eval_output(command))
|
158
163
|
end
|
159
164
|
private :print_usage
|
165
|
+
|
166
|
+
def task_name(task)
|
167
|
+
[rake_namespace, task].join(':')
|
168
|
+
end
|
169
|
+
private :task_name
|
160
170
|
end
|
161
171
|
end
|
@@ -21,14 +21,22 @@ module Docker::Compose
|
|
21
21
|
# Working directory (determines compose project name); default is Dir.pwd
|
22
22
|
attr_reader :dir
|
23
23
|
|
24
|
+
# Project name; default is not to pass a custom name
|
25
|
+
attr_reader :project_name
|
26
|
+
|
24
27
|
# Project file; default is 'docker-compose.yml'
|
25
28
|
attr_reader :file
|
26
29
|
|
30
|
+
# Reference to the last executed command.
|
31
|
+
attr_reader :last_command
|
32
|
+
|
27
33
|
def initialize(shell = Backticks::Runner.new(buffered: [:stderr], interactive: true),
|
28
|
-
dir: Dir.pwd, file: 'docker-compose.yml')
|
34
|
+
dir: Dir.pwd, project_name: nil, file: 'docker-compose.yml')
|
29
35
|
@shell = shell
|
36
|
+
@project_name = project_name
|
30
37
|
@dir = dir
|
31
38
|
@file = file
|
39
|
+
@last_command = nil
|
32
40
|
end
|
33
41
|
|
34
42
|
# Validate docker-compose file and return it as Hash
|
@@ -133,8 +141,8 @@ module Docker::Compose
|
|
133
141
|
# @param [Boolean] no_tty disable pseudo-tty allocation (see: -T flag)
|
134
142
|
# @param [String] user run as specified username or uid (see: -u flag)
|
135
143
|
# @raise [Error] if command fails
|
136
|
-
def run(service, *cmd, detached: false, no_deps: false, volumes: [], env: [], rm: false, no_tty: false, user: nil)
|
137
|
-
o = opts(d: [detached, false], no_deps: [no_deps, false], rm: [rm, false], T: [no_tty, false], u: [user, nil])
|
144
|
+
def run(service, *cmd, detached: false, no_deps: false, volumes: [], env: [], rm: false, no_tty: false, user: nil, service_ports: false)
|
145
|
+
o = opts(d: [detached, false], no_deps: [no_deps, false], rm: [rm, false], T: [no_tty, false], u: [user, nil], service_ports: [service_ports, false])
|
138
146
|
env_params = env.map { |v| { e: v } }
|
139
147
|
volume_params = volumes.map { |v| { v: v } }
|
140
148
|
run!('run', o, *env_params, *volume_params, service, cmd)
|
@@ -246,6 +254,11 @@ module Docker::Compose
|
|
246
254
|
# @return [String] output of the command
|
247
255
|
# @raise [Error] if command fails
|
248
256
|
def run!(*args)
|
257
|
+
project_name_args = if @project_name
|
258
|
+
[{ project_name: @project_name }]
|
259
|
+
else
|
260
|
+
[]
|
261
|
+
end
|
249
262
|
file_args = case @file
|
250
263
|
when 'docker-compose.yml'
|
251
264
|
[]
|
@@ -259,10 +272,10 @@ module Docker::Compose
|
|
259
272
|
end
|
260
273
|
|
261
274
|
@shell.chdir = dir
|
262
|
-
|
263
|
-
status =
|
264
|
-
out =
|
265
|
-
err =
|
275
|
+
@last_command = @shell.run('docker-compose', *project_name_args, *file_args, *args).join
|
276
|
+
status = @last_command.status
|
277
|
+
out = @last_command.captured_output
|
278
|
+
err = @last_command.captured_error
|
266
279
|
status.success? || fail(Error.new(args.first, status, out+err))
|
267
280
|
out
|
268
281
|
end
|
@@ -270,7 +283,7 @@ module Docker::Compose
|
|
270
283
|
private
|
271
284
|
|
272
285
|
def docker_ps(id)
|
273
|
-
cmd = @shell.run('docker', 'ps', a: true, f: "id=#{id}", format: Container::PS_FMT).join
|
286
|
+
cmd = @shell.run('docker', 'ps', a: true, f: "id=#{id}", no_trunc: true, format: Container::PS_FMT).join
|
274
287
|
status, out, err = cmd.status, cmd.captured_output, cmd.captured_error
|
275
288
|
raise Error.new('docker ps', status, out+err) unless status.success?
|
276
289
|
lines = out.split(/[\r\n]+/)
|
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
|
+
version: 1.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Spataro
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backticks
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,24 +106,26 @@ homepage: https://github.com/xeger/docker-compose
|
|
106
106
|
licenses:
|
107
107
|
- MIT
|
108
108
|
metadata: {}
|
109
|
-
post_install_message:
|
109
|
+
post_install_message:
|
110
110
|
rdoc_options: []
|
111
111
|
require_paths:
|
112
112
|
- lib
|
113
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '2.0'
|
118
|
+
- - "<"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '4.0'
|
118
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
122
|
requirements:
|
120
123
|
- - ">="
|
121
124
|
- !ruby/object:Gem::Version
|
122
125
|
version: '0'
|
123
126
|
requirements: []
|
124
|
-
|
125
|
-
|
126
|
-
signing_key:
|
127
|
+
rubygems_version: 3.2.3
|
128
|
+
signing_key:
|
127
129
|
specification_version: 4
|
128
130
|
summary: Wrapper docker-compose with added Rake smarts.
|
129
131
|
test_files: []
|