class Packer::PostProcessor

Constants

COMPRESS
DOCKER_IMPORT
DOCKER_PUSH
DOCKER_SAVE
DOCKER_TAG
MANIFEST
SHELL_LOCAL
VAGRANT
VALID_POST_PROCESSOR_TYPES

Public Class Methods

get_postprocessor(type) click to toggle source
# File lib/packer/postprocessor.rb, line 30
def self.get_postprocessor(type)
  unless validate_type(type)
    raise UnrecognizedPostProcessorTypeError.new("Unrecognized post-processor type #{type}")
  end

  {
    DOCKER_IMPORT => Packer::PostProcessor::DockerImport,
    DOCKER_PUSH   => Packer::PostProcessor::DockerPush,
    DOCKER_SAVE   => Packer::PostProcessor::DockerSave,
    DOCKER_TAG    => Packer::PostProcessor::DockerTag,
    COMPRESS      => Packer::PostProcessor::Compress,
    SHELL_LOCAL   => Packer::PostProcessor::ShellLocal,
    VAGRANT       => Packer::PostProcessor::Vagrant,
    MANIFEST      => Packer::PostProcessor::Manifest
  }.fetch(type).new
end
new() click to toggle source
Calls superclass method Packer::DataObject::new
# File lib/packer/postprocessor.rb, line 51
def initialize
  super
  self.add_required('type')
end
types() click to toggle source
# File lib/packer/postprocessor.rb, line 47
def self.types
  VALID_POST_PROCESSOR_TYPES
end

Private Class Methods

validate_type(type) click to toggle source
# File lib/packer/postprocessor.rb, line 74
def self.validate_type(type)
  VALID_POST_PROCESSOR_TYPES.include? type
end

Public Instance Methods

except(buildname) click to toggle source
# File lib/packer/postprocessor.rb, line 63
def except(buildname)
  unless self.data.key? 'except'
    self.data['except'] = []
  end
  self.data['except'] << buildname.to_s
end
keep_input_artifact(bool) click to toggle source
# File lib/packer/postprocessor.rb, line 70
def keep_input_artifact(bool)
  self.__add_boolean('keep_input_artifact', bool)
end
only(buildname) click to toggle source
# File lib/packer/postprocessor.rb, line 56
def only(buildname)
  unless self.data.key? 'only'
    self.data['only'] = []
  end
  self.data['only'] << buildname.to_s
end