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.
This commit is contained in:
@@ -51,7 +51,7 @@ fn a_search_lists_pull_requests_and_issues_with_where_they_are() {
|
||||
|
||||
pub(super) const MERGED_NONE: &str = include_str!("../../fixtures/merged_below_none.json");
|
||||
|
||||
/// Real answers from restacking a scratch stack on luxe-dev: the bottom squash-merged with its
|
||||
/// Real answers from restacking a scratch stack: the bottom squash-merged with its
|
||||
/// branch kept, and a layer with nothing merged below it. A retargeted one names the base it
|
||||
/// was moved from.
|
||||
#[test]
|
||||
@@ -72,7 +72,7 @@ fn what_merged_below_a_stack_is_read_with_where_it_went() {
|
||||
|
||||
pub(super) const STATUS_UNSTACKED: &str =
|
||||
include_str!("../../fixtures/branch_status_unstacked.json");
|
||||
/// Luxe's own chain on luxe-dev, read from the middle: seven below down to `master`, two above,
|
||||
/// A real chain of Luxe's own, read from the middle: seven below down to `master`, two above,
|
||||
/// and the evidence that checks wait for trunk — the bottom one has them, this one none.
|
||||
#[test]
|
||||
fn a_pull_request_in_the_middle_of_a_stack_knows_where_it_sits() {
|
||||
|
||||
@@ -28,7 +28,7 @@ fn gh_names_a_repository_off_github_com_by_host() {
|
||||
assert!(!repository.is("nora-quinn/luxe"));
|
||||
}
|
||||
|
||||
// From the scratch pull request nora-quinn/luxe-dev#141, posted to and closed for this.
|
||||
// From a scratch pull request, posted to and closed for this.
|
||||
pub(super) const PR_FILES: &str = include_str!("../../fixtures/pr_files.jsonl");
|
||||
pub(super) const THREADS_OWN: &str = include_str!("../../fixtures/review_threads_own.json");
|
||||
pub(super) const THREAD_REPLY: &str = include_str!("../../fixtures/thread_reply.json");
|
||||
@@ -135,8 +135,8 @@ fn the_conversation_comes_with_the_threads() {
|
||||
assert!(before.conversation.is_empty() && !before.threads.is_empty());
|
||||
}
|
||||
|
||||
/// On luxe-dev#169 the reader answered the first comment from Luxe, so it and the answer stay
|
||||
/// quiet, and the review's summary is what is still asked.
|
||||
/// On a real pull request the reader answered the first comment from Luxe, so it and the answer
|
||||
/// stay quiet, and the review's summary is what is still asked.
|
||||
#[test]
|
||||
fn an_answered_comment_on_a_real_pull_request_asks_nothing() {
|
||||
let read = parse_review_threads(THREADS_CONVERSATION).unwrap();
|
||||
|
||||
@@ -272,8 +272,8 @@ fn the_on_disk_entry_shape_is_frozen() {
|
||||
r#"{"id":"e3","parent_id":"e2","ts":7,"kind":{"kind":"header","data":{"cwd":"/w","created":7}}}"#
|
||||
);
|
||||
|
||||
// A link to the pull request a session worked on, copied from the round trip that closed
|
||||
// #146 on luxe-dev: `luxe --from-pr` reads exactly this
|
||||
// A link to the pull request a session worked on, copied from a real round trip that closed
|
||||
// one: `luxe --from-pr` reads exactly this
|
||||
let stored = r#"{"id":"f25fd65c-ee99-4db8-9ed9-76aa08ed7fd9","parent_id":"035e7a31-2d6b-410a-b1d1-361920bf0615","ts":1790289080,"kind":{"kind":"pull_request_link","data":{"number":146,"url":"https://github.com/nora-quinn/luxe-dev/pull/146"}}}"#;
|
||||
let entry: Entry = serde_json::from_str(stored).unwrap();
|
||||
assert_eq!(
|
||||
|
||||
@@ -47,16 +47,32 @@ pub enum InstallSource {
|
||||
Homebrew,
|
||||
/// A path a distribution's package manager owns (`/usr/bin`, `/bin`).
|
||||
SystemPackage,
|
||||
/// A release archive, an installer script, `/usr/local/bin`, or a local build.
|
||||
/// Luxe's own installer script, known by the updater it puts beside the binary.
|
||||
Installer,
|
||||
/// A release archive, `/usr/local/bin`, or a local build.
|
||||
Archive,
|
||||
}
|
||||
|
||||
/// The updater Luxe's installer script puts beside the binary, named `<package>-update` by dist.
|
||||
pub const INSTALLER_UPDATER: &str = "luxe-cli-update";
|
||||
|
||||
impl InstallSource {
|
||||
/// Classify the running binary. Falls back to [`InstallSource::Archive`], which is the state
|
||||
/// that gives the most cautious advice ("download the new release") rather than the most
|
||||
/// confident.
|
||||
pub fn detect() -> Self {
|
||||
std::env::current_exe().map(|path| Self::from_path(&path)).unwrap_or(Self::Archive)
|
||||
std::env::current_exe().map(|path| Self::from_install(&path)).unwrap_or(Self::Archive)
|
||||
}
|
||||
|
||||
/// Classify a binary by what sits beside it, then by its path. The installer's updater beside
|
||||
/// it decides first: the installer puts it wherever it installs, `~/.cargo/bin` included when
|
||||
/// told to, and no path says "installer" on its own.
|
||||
pub fn from_install(binary: &Path) -> Self {
|
||||
let updater = format!("{INSTALLER_UPDATER}{}", std::env::consts::EXE_SUFFIX);
|
||||
match binary.parent().map(|dir| dir.join(updater)) {
|
||||
Some(path) if path.is_file() => Self::Installer,
|
||||
_ => Self::from_path(binary),
|
||||
}
|
||||
}
|
||||
|
||||
/// Classify a path. Split out from [`Self::detect`] because a function that can only be
|
||||
@@ -94,6 +110,7 @@ impl InstallSource {
|
||||
match self {
|
||||
Self::Cargo => Some(&[&["cargo", "install", "--locked", "--force", "luxe-cli"]]),
|
||||
Self::Homebrew => Some(&[&["brew", "update"], &["brew", "upgrade", "luxe"]]),
|
||||
Self::Installer => Some(&[&[INSTALLER_UPDATER]]),
|
||||
// Which package manager owns it is not knowable without querying one, and guessing
|
||||
// `apt` on an Arch machine is the failure this whole function exists to avoid.
|
||||
Self::SystemPackage => None,
|
||||
|
||||
@@ -31,6 +31,36 @@ fn the_update_steps_are_the_owners_own_commands() {
|
||||
assert_eq!(InstallSource::Archive.update_steps(), None, "a download has no owner to ask");
|
||||
}
|
||||
|
||||
/// The installer's updater beside the binary marks an installer copy wherever it lives, a
|
||||
/// `~/.cargo/bin` it was told to use included, and that updater is its update. Without it the
|
||||
/// path decides, as before.
|
||||
#[test]
|
||||
fn the_installers_updater_beside_the_binary_marks_an_installer_copy() {
|
||||
let dir = tempfile::tempdir().expect("tempdir");
|
||||
let bin = dir.path().join(".cargo/bin");
|
||||
std::fs::create_dir_all(&bin).expect("bin dir");
|
||||
let luxe = bin.join(format!("luxe{}", std::env::consts::EXE_SUFFIX));
|
||||
std::fs::write(&luxe, b"").expect("a stand-in luxe");
|
||||
assert_eq!(InstallSource::from_install(&luxe), InstallSource::Cargo, "no updater: the path");
|
||||
|
||||
let updater = bin.join(format!("{INSTALLER_UPDATER}{}", std::env::consts::EXE_SUFFIX));
|
||||
std::fs::write(&updater, b"").expect("a stand-in updater");
|
||||
assert_eq!(InstallSource::from_install(&luxe), InstallSource::Installer);
|
||||
let steps: &[&[&str]] = &[&["luxe-cli-update"]];
|
||||
assert_eq!(InstallSource::Installer.update_steps(), Some(steps));
|
||||
}
|
||||
|
||||
/// A directory named like the updater is not the updater.
|
||||
#[test]
|
||||
fn a_directory_named_like_the_updater_does_not_count() {
|
||||
let dir = tempfile::tempdir().expect("tempdir");
|
||||
let luxe = dir.path().join("luxe");
|
||||
std::fs::write(&luxe, b"").expect("a stand-in luxe");
|
||||
let name = format!("{INSTALLER_UPDATER}{}", std::env::consts::EXE_SUFFIX);
|
||||
std::fs::create_dir(dir.path().join(name)).expect("a directory");
|
||||
assert_ne!(InstallSource::from_install(&luxe), InstallSource::Installer);
|
||||
}
|
||||
|
||||
/// Homebrew is checked first because its Linux and Intel-macOS prefixes sit *inside* paths the
|
||||
/// other arms would otherwise claim.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user