module Docker::Helpers

Constants

VERSION

Public Class Methods

get_image(opts = {}) click to toggle source
# File lib/docker/helpers.rb, line 17
def get_image(opts = {})
  if opts[:image_id]
    Docker::Image.get(opts[:image_id])
  else
    build_dir = opts[:build_dir] || '.'
    Docker::Image.build_from_dir(build_dir, opts, &output_stream)
  end
end
output_stream() click to toggle source
# File lib/docker/helpers.rb, line 8
def output_stream
  lambda { |v|
    body, should_output = should_output?(v)
    if should_output
      $stdout.puts body["stream"]
    end
  }
end

Private Class Methods

should_output?( string ) click to toggle source
# File lib/docker/helpers.rb, line 27
def should_output?( string )
  parsed = JSON.parse(string)
  worth_showing = parsed && parsed.has_key?("stream") && ENV['DEBUG']

  [parsed, worth_showing]
end