Expand description
Newer releases of an app’s binary: finding them, and installing one.
A binary’s releases are a GitHub repository’s, tagged <prefix><version>
(ReleaseSource). latest_release finds the newest; the app server asks it once a
day and shows the answer in status. The update command (UpdateArgs) goes one step
further and replaces the running executable with the release’s, but only:
- with a newer version: never a downgrade;
- with the asset for this platform,
<asset>-<os>-<arch>[.exe], downloaded over HTTPS from the repository’s own release: GitHub is the authority on what was released; - when the executable was placed by hand, not by
cargo install,cargo binstallor a package manager, whose own bookkeeping a replaced file would contradict (InstallMethod).
Downloading and replacing are behind the self-update feature (on by default), the
command line (UpdateArgs, run) behind cli; without self-update the crate only looks
releases up and words advice.
Restarting afterwards is the caller’s: the CLI says so, and the GUI panel restarts the app, its services or a bridge itself.
Structs§
- Asset
- One file of a release.
- Release
- One published release.
- Release
Source - Where a binary’s releases are published: a GitHub repository whose releases are tagged
<prefix><version>, and — for theupdatecommand — the file in them.
Enums§
- Binstall
Source - Where
cargo binstalltook a crate from, which decides how to run it again. - Error
- Errors from finding, fetching or installing a release.
- Install
Method - How the running executable came to be where it is, which decides whether
updatemay replace it. - Store
Kind - The store an app was installed from.
Functions§
- advice
- What to tell the user to do about
releasewhen the binary installed asmethodis not replaced in place: where to download it, or which package manager to ask. - advice_
command - The command that updates a binary installed as
method, when there is one to run:cargo installorcargo binstallwith what it was installed from. - asset_
name - The file a release publishes
baseunder for this machine:<base>-<os>-<arch>, with.exeon Windows. - cargo_
home $CARGO_HOME, or~/.cargo.- client
- An HTTP client that names itself
user_agent(GitHub refuses requests without one). - download_
asset - Download
release’s file for this machine, the onesourcenames withReleaseSource::asset. - install
- Write
bytesbesideexeand hand the new file toreplace, which puts it inexe’s place. The staging file is removed afterwards, whateverreplacedid. - install_
method - How the executable at
exewas installed, judged by where it is and, under$CARGO_HOME/bin, bycargo binstall’s records.cargo_homeis$CARGO_HOME, or~/.cargowhen unset. - latest_
release - Ask GitHub for
source’s newest release. - platform
- This machine as release files name it:
linux-x86_64,macos-aarch64,windows-x86_64. - replace_
file - Replace the executable at
pathwithbytes, even while it runs: a running program keeps the old file (unix) or can be renamed but not overwritten (Windows), so the new one is written beside it and moved into its place. Running copies go on with the old code until they are restarted.
Type Aliases§
- Result
- This crate’s result.