Class: Docker::Template::Stream
Instance Method Summary collapse
-
#initialize ⇒ Stream
constructor
A new instance of Stream.
- #log(part) ⇒ Object
- #progress_error(stream) ⇒ Object
Constructor Details
#initialize ⇒ Stream
Returns a new instance of Stream.
8 9 10 |
# File 'lib/docker/template/stream.rb', line 8 def initialize @lines = {} end |
Instance Method Details
#log(part) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/docker/template/stream.rb', line 14 def log(part) stream = JSON.parse(part) return (stream) if stream.any_keys?("progress", "progressDetail") return $stdout.puts stream["status"] || stream["stream"] if stream.any_keys?("status", "stream") return progress_error(stream) if stream.any_keys?("errorDetail", "error") warn Ansi.red("Unhandled stream message") $stderr.puts Ansi.red("Please file a bug ticket.") $stdout.puts part end |