luxe update and /update, editable question answers, and a version bump owed once per release
- luxe update and /update update Luxe with the command for however it was installed (cargo or
Homebrew), run one program at a time with the terminal attached, then check that the luxe on
PATH is the new version. Luxe never downloads or replaces its own binary. The start screen says
"Update available · /update".
- A question's typed answer edits at its caret: arrows, word jumps, Home, End and Delete work,
and up and down move through a wrapped answer before leaving it.
- The version check owes a bump once per release: the version on main is the next release, and
only a released one (a v-tag) has to move.
- Dependency updates arrive through the sync, so Dependabot and the weekly jobs no longer run here.
2026-10-17 14:14:27 -05:00
|
|
|
use super::*;
|
|
|
|
|
|
|
|
|
|
/// Two files in a temporary directory: the copy the update ran from, and another.
|
|
|
|
|
fn copies() -> (tempfile::TempDir, PathBuf, PathBuf) {
|
|
|
|
|
let dir = tempfile::tempdir().expect("tempdir");
|
|
|
|
|
let updated = dir.path().join("updated-luxe");
|
|
|
|
|
let other = dir.path().join("other-luxe");
|
|
|
|
|
for path in [&updated, &other] {
|
|
|
|
|
std::fs::write(path, b"").expect("a stand-in binary");
|
|
|
|
|
}
|
|
|
|
|
(dir, updated, other)
|
|
|
|
|
}
|
|
|
|
|
|
A v-tag releases Luxe with installers, Homebrew and crates.io, SECURITY.md says how to report a hole, and luxe update runs the installer's updater
- release.yml, generated by dist from dist-workspace.toml, builds macOS, Linux and Windows,
attests every artifact, and publishes shell and PowerShell installers with their updater,
a luxe formula in evanwhittaker/homebrew-tap, and the crates through Trusted Publishing
(publish-crates.yml, which skips versions crates.io already has).
- luxe update recognizes an installer copy by luxe-cli-update beside it and runs that.
- The README, the install guide and the site lead with the installer, Homebrew and Windows.
- SECURITY.md: report privately through a GitHub advisory or contact@luxe.dev.
2026-10-17 15:37:45 -05:00
|
|
|
/// The installer's updater runs from beside the binary even off `PATH`; anything not there, cargo
|
|
|
|
|
/// or brew, is found by name.
|
|
|
|
|
#[test]
|
|
|
|
|
fn a_program_beside_the_binary_runs_from_there() {
|
|
|
|
|
let dir = tempfile::tempdir().expect("tempdir");
|
|
|
|
|
let updater = dir.path().join(format!("luxe-cli-update{}", std::env::consts::EXE_SUFFIX));
|
|
|
|
|
std::fs::write(&updater, b"").expect("a stand-in updater");
|
|
|
|
|
assert_eq!(program_path("luxe-cli-update", Some(dir.path())), updater);
|
|
|
|
|
assert_eq!(program_path("brew", Some(dir.path())), PathBuf::from("brew"));
|
|
|
|
|
assert_eq!(program_path("luxe-cli-update", None), PathBuf::from("luxe-cli-update"));
|
|
|
|
|
}
|
|
|
|
|
|
luxe update and /update, editable question answers, and a version bump owed once per release
- luxe update and /update update Luxe with the command for however it was installed (cargo or
Homebrew), run one program at a time with the terminal attached, then check that the luxe on
PATH is the new version. Luxe never downloads or replaces its own binary. The start screen says
"Update available · /update".
- A question's typed answer edits at its caret: arrows, word jumps, Home, End and Delete work,
and up and down move through a wrapped answer before leaving it.
- The version check owes a bump once per release: the version on main is the next release, and
only a released one (a v-tag) has to move.
- Dependency updates arrive through the sync, so Dependabot and the weekly jobs no longer run here.
2026-10-17 14:14:27 -05:00
|
|
|
#[test]
|
|
|
|
|
fn the_version_is_the_last_word_when_it_is_semver() {
|
|
|
|
|
assert_eq!(parse_version("luxe 0.2.0\n").as_deref(), Some("0.2.0"));
|
|
|
|
|
assert_eq!(parse_version("luxe v0.2.0").as_deref(), Some("0.2.0"));
|
|
|
|
|
assert_eq!(parse_version("luxe nightly"), None);
|
|
|
|
|
assert_eq!(parse_version(""), None);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// The new version reported, or one past it, is a finished update.
|
|
|
|
|
#[test]
|
|
|
|
|
fn a_copy_reporting_the_new_version_is_updated() {
|
|
|
|
|
let (_dir, updated, _) = copies();
|
|
|
|
|
assert_eq!(outcome(Some(&updated), &updated, Some("0.2.0"), "0.2.0"), Outcome::Updated);
|
|
|
|
|
assert_eq!(outcome(Some(&updated), &updated, Some("0.2.1"), "0.2.0"), Outcome::Updated);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// The loop Codex CLI's users hit: the update lands in one file and the shell runs another.
|
|
|
|
|
#[test]
|
|
|
|
|
fn another_copy_first_on_path_is_named() {
|
|
|
|
|
let (_dir, updated, other) = copies();
|
|
|
|
|
let shadowed = outcome(Some(&other), &updated, Some("0.1.0"), "0.2.0");
|
|
|
|
|
assert_eq!(shadowed, Outcome::Shadowed { found: other, updated });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// A symlink to the copy that updated is that copy, as the development install's is, so an old
|
|
|
|
|
/// version there means the package was behind, not that a second copy is in the way.
|
|
|
|
|
#[cfg(unix)]
|
|
|
|
|
#[test]
|
|
|
|
|
fn a_link_to_the_updated_copy_is_the_same_copy() {
|
|
|
|
|
let (dir, updated, _) = copies();
|
|
|
|
|
let link = dir.path().join("luxe");
|
|
|
|
|
std::os::unix::fs::symlink(&updated, &link).expect("symlink");
|
|
|
|
|
let behind = outcome(Some(&link), &updated, Some("0.1.0"), "0.2.0");
|
|
|
|
|
assert_eq!(behind, Outcome::NotYet { reported: "0.1.0".into() });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn no_luxe_on_path_or_no_version_cannot_be_judged() {
|
|
|
|
|
let (_dir, updated, _) = copies();
|
|
|
|
|
assert_eq!(outcome(None, &updated, None, "0.2.0"), Outcome::Unknown);
|
|
|
|
|
assert_eq!(outcome(Some(&updated), &updated, None, "0.2.0"), Outcome::Unknown);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Only the reader's own command is ever named, and a check offers `luxe update` beside it.
|
|
|
|
|
#[test]
|
|
|
|
|
fn the_instructions_name_the_owners_command_or_none() {
|
|
|
|
|
let check = instructions(InstallSource::Cargo, true, false);
|
|
|
|
|
assert!(check.contains("luxe update") && check.contains("cargo install"), "{check}");
|
|
|
|
|
let download = instructions(InstallSource::Archive, false, false);
|
|
|
|
|
assert!(download.contains("download it from"), "{download}");
|
|
|
|
|
let windows = instructions(InstallSource::Cargo, false, true);
|
|
|
|
|
assert!(
|
|
|
|
|
windows.contains("once it has exited") && windows.contains("cargo install"),
|
|
|
|
|
"{windows}"
|
|
|
|
|
);
|
|
|
|
|
}
|