Sha256: 0e8b29974b9c14611db94583bbc7637f2377d53920ba222e16117408b297c82b
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module DockerSync # based on `Docker::Compose::Compose` from `docker-compose` gem class DockerComposeSession def initialize(dir: nil, files: nil) @dir = dir @files = files || [] # Array[String] @last_command = nil end def up(build: false) args = [] args << '--build' if build run!('up', *args) end def stop run!('stop') end def down run!('down') end private def run!(*args) # file_args and args should be Array of String file_args = @files.map { |file| "--file=#{file}" } @last_command = Command.run('docker-compose', *file_args, *args, dir: @dir).join status = @last_command.status out = @last_command.captured_output err = @last_command.captured_error unless status.success? desc = (out + err).strip.lines.first || '(no output)' message = format("'%s' failed with status %s: %s", args.first, status.to_s, desc) raise message end out end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
docker-sync-1.0.0 | lib/docker-sync/docker_compose_session.rb |