Documentation ¶
Index ¶
- Constants
- func CompareSemverish(a SemverishVersion, b SemverishVersion) int
- func Ident(p VersionedPackage) string
- func IsFullyQualified(p VersionedPackage) bool
- func PathFor(p VersionedPackage) string
- func SemverishGreaterOrEqual(a VersionedArtifact, b VersionedArtifact) (bool, error)
- func ShortIdent(p VersionedPackage) string
- func VersionString(v VersionedArtifact) string
- type HabPkg
- func (p *HabPkg) InstallIdent() string
- func (p *HabPkg) MarshalText() ([]byte, error)
- func (p *HabPkg) Name() string
- func (p *HabPkg) Origin() string
- func (p *HabPkg) Release() string
- func (p *HabPkg) String() string
- func (p *HabPkg) UnmarshalText(text []byte) error
- func (p *HabPkg) Version() string
- type Hart
- func (h *Hart) InstallIdent() string
- func (h *Hart) MarshalText() ([]byte, error)
- func (h *Hart) Name() string
- func (h *Hart) Origin() string
- func (h *Hart) Path() string
- func (h *Hart) Release() string
- func (h *Hart) String() string
- func (h *Hart) UnmarshalText(text []byte) error
- func (h *Hart) Version() string
- func (h *Hart) WithName(name string) *Hart
- func (h *Hart) WithOrigin(origin string) *Hart
- type HartDir
- type Installable
- type SemverishVersion
- type SortableHarts
- type VersionedArtifact
- type VersionedPackage
Constants ¶
const ( SemverishGreater = 1 SemverishEqual = 0 SemverishLess = -1 )
Variables ¶
This section is empty.
Functions ¶
func CompareSemverish ¶
func CompareSemverish(a SemverishVersion, b SemverishVersion) int
func Ident ¶
func Ident(p VersionedPackage) string
Ident returns the path form of a package name as ORIGIN/NAME or ORIGIN/NAME/VERSION or ORIGIN/NAME/VERSION/RELEASE
func IsFullyQualified ¶
func IsFullyQualified(p VersionedPackage) bool
IsFullyQualified returns true if both version and release are specified
func PathFor ¶
func PathFor(p VersionedPackage) string
PathFor returns the expected on-disk path for a given packages
func SemverishGreaterOrEqual ¶
func SemverishGreaterOrEqual(a VersionedArtifact, b VersionedArtifact) (bool, error)
GreaterOrEqual returns true if a is greater or equal to b, assuming both VersionedArtifacts use Semverish versions. It assumes Release() return lexically sortable string in case of a tie.
func ShortIdent ¶
func ShortIdent(p VersionedPackage) string
func VersionString ¶
func VersionString(v VersionedArtifact) string
VersionString (ugh, bad name) returns a string representing the version information available in the VersionedArtifact
Types ¶
type HabPkg ¶
type HabPkg struct {
// contains filtered or unexported fields
}
HabPkg represents a Habitat package that can be installed from either the depot or a file on disk using the hab command line tool.
func FromString ¶
FromString takes a string in the form of ORIGIN/NAME and resturns a HabPkg struct
func FromStrings ¶
FromStrings takes a newline separated list of package identifiers and returns a list of HabPkgs.
func NewWithVersion ¶
NewWithVersion constructs a HabPkg with a version (but no release)
func (*HabPkg) InstallIdent ¶
func (*HabPkg) MarshalText ¶
MarshalText turns a HabPkg into text
func (*HabPkg) UnmarshalText ¶
UnmarshalText can take text and parse a HabPkg
type Hart ¶
type Hart struct {
// contains filtered or unexported fields
}
A Hart represents a hartifact archive on disk.
func HartFromPath ¶
HartFromPath parses a path into a Hart
func (*Hart) InstallIdent ¶
func (*Hart) MarshalText ¶
MarshalText turns a HabPkg into text
func (*Hart) Origin ¶
VersionedPackage interface implementation Origin returns the file-name-inferred origin for the hart.
func (*Hart) UnmarshalText ¶
UnmarshalText can take text and parse a HabPkg
func (*Hart) WithOrigin ¶
WithOrigin sets the origin of the hartifact
type HartDir ¶
type HartDir struct {
// contains filtered or unexported fields
}
HartDir represents a collection of harts
func NewHartDir ¶
NewHartDir constructs a hartDir for the given path
type Installable ¶
type Installable interface { VersionedPackage InstallIdent() string }
An Installable represents something that can be installed with `hab pkg install`. Currently this includes HabPkgs and Harts.
type SemverishVersion ¶
type SemverishVersion struct {
// contains filtered or unexported fields
}
SemverishVersion holds a semver-like version. It supports the following format:
[v]VERSION_PART[.VERSION_PART...][-PRERELEASE][+METADATA]
Unlike traditional semver, it supports any non-zero number of version parts.
func ParseSemverishVersion ¶
func ParseSemverishVersion(s string) (SemverishVersion, error)
type SortableHarts ¶
type SortableHarts []Hart
SortableHarts are paths to hartifacts on disk. We expect the files to follow the hartifact naming conventions and sort them by the version and timestamp embedded in the filename.
func (SortableHarts) Len ¶
func (h SortableHarts) Len() int
Implement sort.Interface for sortableHarts allowing us to use the routines in the sort package to do any sorting.
func (SortableHarts) Swap ¶
func (h SortableHarts) Swap(i int, j int)
type VersionedArtifact ¶
VersionedArtifact is an interface for artifacts that use habitat-style VERSION/RELEASE version string
type VersionedPackage ¶
type VersionedPackage interface { Origin() string Name() string VersionedArtifact }
VersionedPackage is an interface to help bridge the gap between HabPkg and Hart.