Documentation
¶
Overview ¶
Package update implements `spec update`: it brings the locally installed spec binary to the newest released version by delegating to whatever mechanism manages the install (Homebrew, go install, or a raw release binary it self-replaces). The engine is split into a side-effect-free Plan phase and a mutating Apply phase so `--check` never touches the system.
Index ¶
Constants ¶
const DevVersion = "dev"
DevVersion is the sentinel version stamped into binaries built without a release tag (the default value of cmd.Version). It never compares as up-to-date, so `spec update` always offers an upgrade for dev builds.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Method ¶
type Method string
Method identifies how the running binary was installed, which determines the mechanism `spec update` delegates to.
const ( // MethodHomebrew indicates a Homebrew-managed install (brew upgrade). MethodHomebrew Method = "homebrew" // MethodGoInstall indicates a `go install`-managed install. MethodGoInstall Method = "go-install" // MethodBinary indicates a raw release binary with no package manager; // `spec update` self-replaces it from the GitHub release. MethodBinary Method = "binary" )
func DetectMethod ¶
DetectMethod classifies how the executable at execPath was installed. The path is resolved through symlinks first so a Homebrew shim in bin/ is traced back to its Cellar location.
type Options ¶
type Options struct {
// CurrentVersion is the version stamped into the running binary.
CurrentVersion string
// ExecPath is the path to the running executable (os.Executable()).
ExecPath string
// TargetVersion pins a specific release tag; empty means latest.
TargetVersion string
// Force proceeds even when already on the target version.
Force bool
}
Options configures an update run.
type Plan ¶
type Plan struct {
Method Method `json:"method"`
CurrentVersion string `json:"current_version"`
LatestVersion string `json:"latest_version"`
UpdateAvailable bool `json:"update_available"`
// contains filtered or unexported fields
}
Plan describes the intended update without performing it. It is produced by Plan and consumed by Apply, and is also the payload for `--check`/`--json`.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater orchestrates an update run against a release source.
func NewUpdater ¶
NewUpdater builds an Updater backed by the live GitHub release API.