class Packer::Output::MachineReadable

Represents commands that produce machine-readable output

Public Instance Methods

ui_messages() click to toggle source

Outputs that would have normally gone to the console if Packer were running in human-readable mode.

@return [Array<Packer::Message::Ui>]

# File lib/packer/output/machine_readable.rb, line 9
def ui_messages
  select_messages('ui').map { |fields| Packer::Message::Ui.from_fields(fields) }
end

Private Instance Methods

select_messages(type) click to toggle source

@api private @param [String] type of message @return [Array<Array>] lists of message fields

# File lib/packer/output/machine_readable.rb, line 18
def select_messages(type)
  stdout
    .split("\n")
    .map { |line| CSV.parse(line, quote_char: "\x00").first }
    .select { |fields| fields[2] == type }
end