kex docs Tey

Tey.SelfUpdate

module Tey.SelfUpdate

currentPrefix

currentPrefix : String?

Where this Tey is installed, or None when it cannot be told — outside an installed launcher (a source checkout, erl by hand) there is nothing safe to overwrite. tey/bin/tey exports TEY_EBIN before invoking the BEAM, so a released install always knows.

installEbin

installEbin : String?

The launcher's own runtime directory. TEY_EBIN can instead name the Tey paired with the selected Kex (see installPaired), which is not an install to upgrade — TEY_INSTALL_EBIN always names the launcher's.

prefixOf

prefixOf(ebin: String) -> String?

TEY_EBIN with the trailing /lib/kex/tey/ebin stripped. Anything else — unset, empty, a checkout's tey/ebin — is None: there is no install prefix to upgrade in place.

homebrewManaged?

homebrewManaged?(prefix: String) -> Bool

Whether this install belongs to Homebrew, whose keg bookkeeping Tey must not fight: that Tey upgrades with brew upgrade tey.

manifestVersion

manifestVersion(text: String) -> String?

The version("...") line of a package.kex manifest, read as plain text. The manifest reader cannot be used here: it parses a LOCAL package through the selected compiler, and this text was just downloaded, not installed.

compareVersions

compareVersions(a: String, b: String) -> Ordering

Ordering for two version strings, for the already-newest guard. Something unparsable compares as older: a hand-edited development version must never read as "newer than every release" and refuse its own upgrade.

Written over newer? rather than compare on purpose: a trait method from another module's make ..., implement: Comparable does not dispatch to a custom record from outside that module on the BEAM backend, while a plain let like newer? calls anywhere.

carryBakedErlText

carryBakedErlText(oldLauncher: String, newLauncher: String) -> String

A source install (make -C tey install) bakes an absolute erl into bin/tey; release archives bake a bare erl resolved from PATH. Upgrading must not silently move the former onto the latter, so the old absolute path is carried into the new launcher. Anything else (no line, a relative erl, the dev placeholder) leaves the new launcher exactly as published.

tagFor

tagFor(tags: [String], version: String) -> String?

The tag naming a Kex version, resolved against a tag list read once — Tey.Toolchain.releaseTag answers the same question but re-lists the tags on every call, which a pinned-version scan cannot afford.

firstSelfUpgrading constant

The oldest Tey with an upgrade command. Pinning an older one would strand the install — 0.2.0 cannot run tey upgrade to come back — so it is refused, with the installer as the deliberate way there.

installedVersion

installedVersion(prefix: String) -> String

The version of the Tey installed at prefix, which is not always the one running: with a Kex selected whose own Tey is unpacked beside it (see installPaired), the launcher runs that one instead. Comparing the running version against a release then answers "already the newest" while the install itself stays old. The installed launcher is asked directly, pointed at its own runtime; if that cannot be read, the running version is the answer — the behaviour before, and never a reason to downgrade.

upgradeLatest

upgradeLatest(includePre: Bool) -> Result<UpgradeOutcome, String>

tey upgrade — the newest released Tey: the one the newest Kex release's manifest declares. Stable Kex releases unless includePre (--pre), which is how a pre-release Tey is reached without knowing its number.

upgradePinned

upgradePinned(version: String) -> Result<UpgradeOutcome, String>

tey upgrade <version> — exactly that Tey, from the newest release (stable first, then pre-releases) whose manifest declares it. An older version is allowed: pinning is explicit, and it is the way back from a bad release.

installPaired

installPaired(kexVersion: String) -> Result<String?, String>

The Tey a Kex release ships, unpacked beside that toolchain so bin/tey runs it whenever that Kex is selected: Kex and Tey are developed and released as a pair, and a pre-release is only tested properly as that pair. Nothing installed is replaced — not even a Homebrew keg — which is what makes this safe to do on every tey kex install.

The answer is the Tey version unpacked, or None when it was already there: tags do not move, so neither does what they carry.

type UpgradeOutcome

Upgrading Tey itself (tey upgrade), for installs that came from a release archive rather than a package manager — see install.sh at the repository root. A Homebrew-managed Tey is brew's to upgrade and is refused here.

Tey has its own version and its own cadence (tey/package.kex), so it cannot reuse the Kex tag list directly: the newest Tey is the one the newest Kex release's manifest declares. That manifest is read over plain HTTPS (raw.githubusercontent.com) with the same curl-then-wget idiom Tey.Toolchain.download already uses — no GitHub API, no rate limits, no clone. The archive itself is the tey-<version>.tar.gz the release workflow publishes beside the Kex archives, under the same tag.

What tey upgrade found: either the version it installed and where, or why there was nothing to install.

Variants

  • Upgraded(String, String)
  • AlreadyNewest(String)
  • NewerThanRelease(String)