Skip to main content

Crate corundum_framework_update

Crate corundum_framework_update 

Source
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 binstall or 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.
PackageStatus
Where a self-updating package stands: the running version and what the updater is doing.
Release
One published release.
ReleaseSource
Where a binary’s releases are published: a GitHub repository whose releases are tagged <prefix><version>, and — for the update command — the file in them.

Enums§

BinstallSource
Where cargo binstall took a crate from, which decides how to run it again.
Error
Errors from finding, fetching or installing a release.
InstallMethod
How the running executable came to be where it is, which decides whether update may replace it.
PackageState
What a package’s updater is doing.
StoreKind
The store an app was installed from.

Functions§

advice
What to tell the user to do about release when the binary installed as method is 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 install or cargo binstall with what it was installed from.
asset_name
The file a release publishes base under for this machine: <base>-<os>-<arch>, with .exe on 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 one source names with ReleaseSource::asset.
install
Write bytes beside exe and hand the new file to replace, which puts it in exe’s place. The staging file is removed afterwards, whatever replace did.
install_method
How the executable at exe was installed, judged by where it is and, under $CARGO_HOME/bin, by cargo binstall’s records. cargo_home is $CARGO_HOME, or ~/.cargo when 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 path with bytes, 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.