Skip to main content

Module ghola_install

Module ghola_install 

Source
Expand description

§Ghola install

Finds the Ghola sidecar binary and installs it from the project’s GitHub releases.

Nothing here asks the user: the CLI asks first and calls install_latest only on a yes.

An install takes the latest release of robot-accomplice/ghola, picks the archive for this OS and CPU (ghola_<ver>_<os>_<arch>.tar.gz, or .zip on Windows), checks its SHA-256 against the release’s checksums.txt, and only then extracts ghola (ghola.exe) from the archive root to install_dir. The file is written to a temporary name and renamed into place. PATH is never changed: scope runs the binary by its full path.

checksums.txt is not signed. The check proves the archive is the one the release lists; HTTPS to GitHub is what ties the release to its publisher. Every request, redirects included, must be HTTPS to a GitHub host.

The download goes through a ReleaseSource, so tests use a fake release and never touch the network.

Structs§

GithubReleases
Downloads from GitHub over HTTPS. Any other URL, and any redirect to one, is refused.
Target
An OS and CPU, in the names Ghola’s release archives use.

Enums§

Outcome
What install_latest did.

Constants§

GO_INSTALL
The command that builds Ghola from source.
GO_PACKAGE
The Go package of the binary. The module root has no main package.
LATEST_RELEASE_URL
The GitHub API URL of the latest release.
RELEASES_PAGE
The releases page, for installing by hand.

Traits§

ReleaseSource
Where a download comes from.

Functions§

allowed_url
True when url is HTTPS to a GitHub host that serves releases.
expected_sha256
The SHA-256 that checksums.txt (<hex> <file> lines) gives for file.
find
The Ghola binary: on PATH, else in install_dir.
find_go
go on PATH, for building Ghola when no release archive fits.
go_install
Builds Ghola with go install into dir (through GOBIN) and returns the binary’s path.
in_path
The program name in one of the path folders, with the platform’s executable suffix (ghola.exe on Windows). It looks in the folders itself: Windows has no which.
install_dir
Where scope installs Ghola: <scope home>/bin.
install_latest
Installs the latest Ghola release for target into dir.
locate
The Ghola binary: in a path folder, else in dir.
manual_steps
How to install Ghola by hand, one line each.