class Packer::Output::Build

Represents the output from +packer build+.

@see www.packer.io/docs/command-line/build.html

Public Instance Methods

artifacts() click to toggle source

Information about an artifact of the targeted item.

@return [Array<Packer::Message::Artifact]

# File lib/packer/output/build.rb, line 10
def artifacts
  afcts = []

  afct ||= Packer::Message::Artifact.new
  select_messages('artifact').each do |fields|
    afct.timestamp ||= fields[0]
    afct.target ||= fields[1]
    afct.type ||= 'artifact'
    afct.artifact_index ||= fields[3]

    case fields[4]
    when 'builder-id'
      afct.builder_id = fields[5]
    when 'end'
      afcts << afct
      afct = Packer::Message::Artifact.new
    when 'file'
      afct.files ||= []
      afct.files << Packer::Message::ArtifactFile.from_fields(fields)
    when 'files-count'
      next
    when 'id'
      afct.id = fields[5]
    when 'nil'
      afct.nil = true
    when 'string'
      afct.string = fields[5]
    end
  end

  afcts
end
errors() click to toggle source

Build errors that occurred

@return [Array<Packer::Message::Error]

# File lib/packer/output/build.rb, line 46
def errors
  select_messages('error').map { |fields| Packer::Message::Error.from_fields(fields) }
end