Documentation
¶
Overview ¶
Package repository provides types and operations for managing GitHub releases.
Index ¶
- Variables
- func SelectEdition(a *Asset, msg string, editions []string) error
- type Asset
- type Repository
- func (r *Repository) FetchEditions(a *Asset) (map[string]string, error)
- func (r *Repository) FetchTags() error
- func (r *Repository) GetLatestTag(a *Asset) error
- func (r *Repository) GetTagFromString(a *Asset, version string) error
- func (r *Repository) SelectTag(a *Asset, msg string, sortAscending bool, numTagsToDisplay int) error
- func (r *Repository) SetTagsForTesting(tags []string, latestTag string)
Constants ¶
This section is empty.
Variables ¶
var ValidEditions = []string{"standard", "withdeploy", "extended", "extended_withdeploy"}
ValidEditions is the canonical ordered list of Hugo edition names.
Functions ¶
Types ¶
type Asset ¶
type Asset struct {
ArchiveDirPath string // Directory path of the downloaded archive
ArchiveExt string // Extension of the downloaded archive: pkg, tar.gz, or zip
ArchiveFilePath string // File path of the downloaded archive
ArchiveURL string // Download URL for this asset
Edition string // Edition of the release asset (e.g. standard, extended)
Tag string // User-selected tag associated with the release for this asset
ExecName string // Name of the executable file
}
Asset represents a GitHub release asset for a given release, OS, and architecture.
func (*Asset) SetURLFromEditions ¶ added in v0.14.0
SetURLFromEditions sets ArchiveURL and ArchiveExt on the asset from the editions map using the already-set Edition field. Returns an error if the edition is not present in the map.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository represents a GitHub repository.
func NewRepository ¶
func NewRepository(owner, name string, client *github.Client, cacheDirPath string) (*Repository, error)
NewRepository creates a new Repository instance and fetches releases. cacheDirPath is the local hvm cache directory used to persist the release list between invocations. Pass an empty string to disable caching.
func (*Repository) FetchEditions ¶ added in v0.14.0
func (r *Repository) FetchEditions(a *Asset) (map[string]string, error)
FetchEditions fetches all available edition download URLs for the asset's tag on the current OS and architecture. The returned map is keyed by edition name (e.g. "standard", "extended", "extended_withdeploy", "withdeploy").
func (*Repository) FetchTags ¶
func (r *Repository) FetchTags() error
FetchTags fetches tags associated with recent releases.
func (*Repository) GetLatestTag ¶
func (r *Repository) GetLatestTag(a *Asset) error
GetLatestTag returns the most recent tag from the repository.
func (*Repository) GetTagFromString ¶
func (r *Repository) GetTagFromString(a *Asset, version string) error
GetTagFromString parses and validates a version string and sets it on the asset.
func (*Repository) SelectTag ¶
func (r *Repository) SelectTag(a *Asset, msg string, sortAscending bool, numTagsToDisplay int) error
SelectTag prompts the user to select a tag from a list of recent tags. sortAscending determines the sort order, numTagsToDisplay limits the count.
func (*Repository) SetTagsForTesting ¶
func (r *Repository) SetTagsForTesting(tags []string, latestTag string)
SetTagsForTesting sets tags and latestTag directly. For use in tests only.