Class: LocalDevelopmentGateway::Docker

Inherits:
Object
  • Object
show all
Defined in:
lib/local_development_gateway.rb

Instance Method Summary collapse

Instance Method Details

#call(*args, capture: true) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/local_development_gateway.rb', line 29

def call(*args, capture: true)
  command = ["docker", *args]
  if capture
    stdout, stderr, status = Open3.capture3(*command)
    unless status.success?
      raise DockerError.new(command, stderr.empty? ? stdout : stderr)
    end

    stdout
  elsif system(*command)
    true
  else
    raise DockerError.new(command, "")
  end
end