Class: Dev::Docker::Status

Inherits:
Object show all
Defined in:
lib/firespring_dev_commands/docker/status.rb

Overview

Class containing constants for docker status names and groups

Constant Summary collapse

CREATED =

Docker created status name

:created
RESTARTING =

Docker restarting status name

:restarting
RUNNING =

Docker running status name

:running
REMOVING =

Docker removing status name

:removing
PAUSED =

Docker paused status name

:paused
EXITED =

Docker exited status name

:exited
DEAD =

Docker dead status name

:dead
ALL =

Array containing all available docker statuses

[
  CREATED,
  RESTARTING,
  RUNNING,
  REMOVING,
  PAUSED,
  EXITED,
  DEAD
].freeze

Instance Method Summary collapse

Instance Method Details

#response_callback(response) ⇒ Object

TODO: Can we use ‘curses’ here and overwrite the correct line?



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/firespring_dev_commands/docker/status.rb', line 38

def response_callback(response)
  response.split("\n").each do |line|
    data = JSON.parse(line)
    if data.include?('status')
      if data['id']
        LOG.info "#{data['id']}: #{data['status']}"
      else
        LOG.info (data['status']).to_s
      end
    elsif data.include?('errorDetail')
      raise data['errorDetail']['message']
    elsif data.include?('aux')
      next
    else
      raise "Unrecognized message from docker: #{data}"
    end
  end
end