Class: FPM::Fry::BuildOutputParser
- Inherits:
-
Struct
- Object
- Struct
- FPM::Fry::BuildOutputParser
- Defined in:
- lib/fpm/fry/build_output_parser.rb
Instance Attribute Summary collapse
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#out ⇒ Object
Returns the value of attribute out.
Instance Method Summary collapse
- #call(chunk, *_) ⇒ Object
-
#initialize(*_) ⇒ BuildOutputParser
constructor
A new instance of BuildOutputParser.
Constructor Details
#initialize(*_) ⇒ BuildOutputParser
Returns a new instance of BuildOutputParser.
7 8 9 10 |
# File 'lib/fpm/fry/build_output_parser.rb', line 7 def initialize(*_) super @images = [] end |
Instance Attribute Details
#images ⇒ Object (readonly)
Returns the value of attribute images.
5 6 7 |
# File 'lib/fpm/fry/build_output_parser.rb', line 5 def images @images end |
#out ⇒ Object
Returns the value of attribute out
3 4 5 |
# File 'lib/fpm/fry/build_output_parser.rb', line 3 def out @out end |
Instance Method Details
#call(chunk, *_) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fpm/fry/build_output_parser.rb', line 12 def call(chunk, *_) # new docker for Mac results in data like this: # "{'stream':' ---\\u003e 3bc51d6a4c46\\n'}\r\n{'stream':'Step 2 : WORKDIR /tmp/build\\n'}\r\n" # this isn't valid JSON, of course, so we process each part individually chunk.split("\r\n").each do |sub_chunk| json = JSON.parse(sub_chunk) stream = json['stream'] if /\ASuccessfully built (\w+)\Z/.match(stream) images << $1 end out << stream end end |