Documentation
¶
Index ¶
- Constants
- func CompareVersions(a, b string) (int, bool)
- func HomebrewCaskVersion(ctx context.Context) (string, error)
- func IsComparableVersion(version string) bool
- func IsNewer(latest, current string) bool
- func ManualCommands(latestVersion string) []string
- func NormalizeVersion(version string) string
- func RenderNotice(w io.Writer, result CheckResult)
- func RunAction(ctx context.Context, action Action, stdout, stderr io.Writer) error
- func RunShellArchiveUpgrade(ctx context.Context, action Action, stdout, stderr io.Writer) error
- func ShellInstallerURLForTag(tag string) string
- func VerifyUpgrade(ctx context.Context, installContext InstallContext, ...) error
- type Action
- type Check
- type CheckOptions
- type CheckResult
- type InstallContext
- type LatestRelease
- type ManualUpgradeCommands
- type UpdateCache
- func (c *UpdateCache) MarkChecked() error
- func (c *UpdateCache) ReadFresh(currentVersion string, maxAge time.Duration) (CheckResult, bool)
- func (c *UpdateCache) ReadStatus(currentVersion string, releaseMaxAge, failureBackoff time.Duration) (result CheckResult, hasFreshRelease bool, recentlyChecked bool)
- func (c *UpdateCache) RecentlyChecked(maxAge time.Duration) bool
- func (c *UpdateCache) Write(result CheckResult) error
- type UpdateCacheData
Constants ¶
View Source
const ( DefaultCacheMaxAge = 24 * time.Hour DefaultFailureBackoff = time.Hour )
View Source
const ( DefaultLatestReleaseURL = "https://api.github.com/repos/daveshanley/vacuum/releases/latest" DefaultReleaseNotesURL = "https://github.com/daveshanley/vacuum/releases/latest" )
View Source
const ( EnvManagedByNPM = "VACUUM_MANAGED_BY_NPM" EnvManagedRoot = "VACUUM_MANAGED_PACKAGE_ROOT" MethodNPM = "npm" MethodHomebrew = "homebrew" MethodShell = "shell" MethodManual = "manual" MethodUnknown = "unknown" BrewCaskToken = "vacuum" NPMPackageName = "@quobix/vacuum" )
Variables ¶
This section is empty.
Functions ¶
func CompareVersions ¶
CompareVersions compares simple stable semver values. It returns ok=false for unknown, source, or prerelease-looking versions.
func IsComparableVersion ¶
func ManualCommands ¶
func NormalizeVersion ¶
NormalizeVersion removes the leading tag prefix used by Vacuum releases.
func RenderNotice ¶
func RenderNotice(w io.Writer, result CheckResult)
func RunShellArchiveUpgrade ¶
func ShellInstallerURLForTag ¶
func VerifyUpgrade ¶
func VerifyUpgrade(ctx context.Context, installContext InstallContext, method, latestVersion string) error
Types ¶
type Action ¶
type Action struct {
Method string
Command string
Args []string
CanRun bool
Reason string
Executable string
LatestVersion string
ManualCommand string
}
func PlanUpgrade ¶
func PlanUpgrade(ctx InstallContext, latestVersion string) Action
func (Action) CommandString ¶
type Check ¶
type Check struct {
// contains filtered or unexported fields
}
func CompletedCheck ¶
func CompletedCheck(result CheckResult) *Check
func StartCheck ¶
func StartCheck(opts CheckOptions) *Check
StartCheck begins a latest-release probe in the background.
func (*Check) TryResult ¶
func (c *Check) TryResult() (result CheckResult, ok bool)
TryResult returns immediately. If the network request has not finished, ok is false and callers should cancel the check and exit.
func (*Check) WaitResult ¶
func (c *Check) WaitResult() (CheckResult, bool)
WaitResult waits until the latest-release probe finishes or times out.
type CheckOptions ¶
type CheckResult ¶
func (CheckResult) UpdateAvailable ¶
func (r CheckResult) UpdateAvailable() bool
type InstallContext ¶
func DetectInstallContext ¶
func DetectInstallContext() InstallContext
func DetectInstallContextFrom ¶
func DetectInstallContextFrom(executable string, getenv func(string) string) InstallContext
type LatestRelease ¶
type LatestRelease struct {
TagName string `json:"tag_name"`
HTMLURL string `json:"html_url"`
Prerelease bool `json:"prerelease"`
Draft bool `json:"draft"`
}
func FetchLatestRelease ¶
func FetchLatestRelease(ctx context.Context, opts CheckOptions) (*LatestRelease, error)
type ManualUpgradeCommands ¶
func ManualCommandSet ¶
func ManualCommandSet(latestVersion string) ManualUpgradeCommands
type UpdateCache ¶
func DefaultUpdateCache ¶
func DefaultUpdateCache() (*UpdateCache, error)
func (*UpdateCache) MarkChecked ¶
func (c *UpdateCache) MarkChecked() error
func (*UpdateCache) ReadFresh ¶
func (c *UpdateCache) ReadFresh(currentVersion string, maxAge time.Duration) (CheckResult, bool)
func (*UpdateCache) ReadStatus ¶
func (c *UpdateCache) ReadStatus(currentVersion string, releaseMaxAge, failureBackoff time.Duration) (result CheckResult, hasFreshRelease bool, recentlyChecked bool)
func (*UpdateCache) RecentlyChecked ¶
func (c *UpdateCache) RecentlyChecked(maxAge time.Duration) bool
func (*UpdateCache) Write ¶
func (c *UpdateCache) Write(result CheckResult) error
Click to show internal directories.
Click to hide internal directories.