From c0eb6fce65246e333a134b0aedad7e30ebec144d Mon Sep 17 00:00:00 2001 From: Mofei Zhu Date: Mon, 19 Oct 2026 19:41:11 +0300 Subject: [PATCH] Point the repository URL at mapbox/mapbox-cli REPO_URL and Cargo.toml still named github.com/mapbox/cli, which redirects to a private repo, so the issues link in account_usage's error was a 404 for anyone outside. The installers already name mapbox/mapbox-cli. A source guard now holds all four copies to Cargo.toml's repository. --- Cargo.toml | 2 +- src/main.rs | 2 +- tests/source_guards.rs | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 714ae54..51cfd7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "mapbox-cli" version = "0.3.0" edition = "2021" description = "A command-line interface for Mapbox APIs, with commands generated at build time from OpenAPI specs." -repository = "https://github.com/mapbox/cli" +repository = "https://github.com/mapbox/mapbox-cli" # The file rather than an SPDX expression: LICENSE is Mapbox's own terms and # not an OSI license, so there is no identifier that says what it grants. license-file = "LICENSE" diff --git a/src/main.rs b/src/main.rs index 3e37c13..4c1823e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use clap::{Arg, ArgAction, ArgMatches, Command}; /// which see it only from here on. macro_rules! repo_url { () => { - "https://github.com/mapbox/cli" + "https://github.com/mapbox/mapbox-cli" }; } diff --git a/tests/source_guards.rs b/tests/source_guards.rs index 547068b..c91aae3 100644 --- a/tests/source_guards.rs +++ b/tests/source_guards.rs @@ -597,3 +597,34 @@ fn every_test_that_runs_the_binary_keeps_the_token_fetch_offline() { on the command they build." ); } + +/// The repository URL is written in four places that cannot share it: the +/// crate's `repo_url!`, `Cargo.toml`, and each installer, which is served on +/// its own. They drifted once, and the crate's issues link pointed at a repo +/// outside users can't open. +#[test] +fn every_copy_of_the_repository_url_agrees() { + let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let expected = env!("CARGO_PKG_REPOSITORY"); + // The first GitHub URL after `marker`, up to its closing quote. + let url_in = |file: &str, marker: &str| -> String { + let text = std::fs::read_to_string(root.join(file)).expect("read a file"); + let after = &text[text + .find(marker) + .unwrap_or_else(|| panic!("{file} has no `{marker}`"))..]; + let start = after.find("https://github.com/").expect("a GitHub URL"); + let url = &after[start..]; + url[..url.find(['"', '\'']).expect("a closing quote")].to_owned() + }; + for (file, marker) in [ + ("src/main.rs", "macro_rules! repo_url"), + ("scripts/install.sh", "REPO="), + ("scripts/install.ps1", "$Repo ="), + ] { + assert_eq!( + url_in(file, marker), + expected, + "{file} names a different repository than Cargo.toml's `repository`" + ); + } +}