buildpackplan

package
v1.91.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2020 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

View Source
const VersionSource = "version-source"

Variables

This section is empty.

Functions

This section is empty.

Types

type MergeFunc added in v1.83.0

type MergeFunc func(a, b Plan) (Plan, error)

func PriorityMerge added in v1.83.0

func PriorityMerge(priorities map[interface{}]int) MergeFunc

PriorityMerge returns a function that merges two Plans together, giving precedence first to the one which declares a version; and then, to the plan which has a higher priority level. PriorityMerge defines a Plan's priority level by looking for a "version-source" key defined in the Plan.Metadata, and uses the provided map to define the priority level for that source. Currently, an unknown source (one specified in a Plan, but not provided in the priority list) has a priority level of 0. An example priority list, used for the Node Engine CNB, is:

"buildpack.yml": 3,
"package.json":  2,
".nvmrc":        1,
"":              -1

Metadata for most cases is combined (excluding version-source, build and launch), with a comma delimiter if present in both plans. version-source is set to the highest priority between the plans, and build/launch will be set to true if either of the plans request them.

type Metadata

type Metadata = buildpackplan.Metadata

Metadata is the metadata of the plan.

type Plan

type Plan = buildpackplan.Plan

Plan represents a contractual buildpack plan.

func ShallowMerge

func ShallowMerge(a, b Plan) (Plan, error)

ShallowMerge merges two Plans together. Declared versions are combined with a comma delimiter and metadata is combined with the values for b taking priority over the values of a when keys are duplicated.

type Plans

type Plans struct {
	buildpackplan.Plans
}

Plan represents a contractual buildpack plan.

func (Plans) Get

func (p Plans) Get(name string) []Plan

Get returns a collection of Plan's that have a given name.

func (Plans) GetMerged

func (p Plans) GetMerged(name string, merge MergeFunc) (Plan, bool, error)

GetMerged returns a single Plan that is a merged version of all of the Plan's that have a given name. A merge function is used to describe how two entries are merged together. Returns true if any matching Plan's were found, false otherwise.

func (Plans) GetPriorityMerged added in v1.83.0

func (p Plans) GetPriorityMerged(name string, priorities map[interface{}]int) (Plan, bool, error)

GetPriorityMerged returns a single Plan that is a merged version of all of the Plan's that have a given name. Merging is accomplished with the PriorityMerge function. Returns true if any matching Plan's were found, false otherwise.

func (Plans) GetShallowMerged

func (p Plans) GetShallowMerged(name string) (Plan, bool, error)

GetShallowMerged returns a single Plan that is a merged version of all of the Plan's that have a given name. Merging is accomplished with the ShallowMerge function. Returns true if any matching Plan's were found, false otherwise.

func (Plans) Has

func (p Plans) Has(name string) bool

Has returns whether there is a Plan with a given name.

type Writer

type Writer = buildpackplan.Writer

Writer is a function write writes the contents of a Plans

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL