Documentation ¶
Overview ¶
Package updater provides a tool to update a binary relying from a http repository (such as Nexus)
Index ¶
Constants ¶
View Source
const ( // FieldName is the binary name FieldName field = iota // FieldVersion is the binary version number FieldVersion // FieldOs is the binary target OS FieldOs // FieldArch is the binary target architecture FieldArch )
View Source
const ( // SortSemver sorts repository entries by version number, according to semver SortSemver sortCriteria = iota )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildInfo ¶
type BuildInfo struct { Name string File string Version *semver.Version Os string Arch string MD5 string URL string }
BuildInfo is an entry of the repository
type Config ¶
type Config struct { // BinaryName is the base name of binary artifacts BinaryName string // TargetPath is the local path to update (default to os.Executable()) TargetPath string // Fields is an ordered array describing filename structure, using field* constants Fields []field // FieldSeparator is the string separating fields in the filename FieldSeparator string // SortCriteria is the sort order that will be applied to find the latest version SortCriteria sortCriteria // Matcher is a pointer to the wanted Matcher func Matcher *Matcher // Repository is the url of the repository where updates are to be found Repository string // TmpPattern is a sprintf pattern defining the local temporary storage for downloaded files TmpPattern string }
Config is the public configuration object to create an Updater
type Matcher ¶
Matcher is a function that can be called to know if a repository entry can be considered as a valid update
type Updater ¶
type Updater struct {
Config
}
Updater is the main object
func (Updater) FindLatest ¶
FindLatest returns the latest eligible build in the repository. It finds all anchors in a html page and try to consider them as a valid build. The latest build that matches, according to the matcher and the sortCriteria order is returned.
Click to show internal directories.
Click to hide internal directories.