Skip to content

Commit

Permalink
Look for just "mac" in a filename when matching for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
autarch committed Nov 24, 2024
1 parent 0076bcf commit 7cabd20
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.2.4

- Look for just "mac" or "Mac" in a filename on macOS. Previously, `ubi` would not treat a filename
like "foo-mac-x86-64.tar.gz" as a match for macOS. Reported by @jdx (Jeff Dickey). GH #79.

## 0.2.3 - 2024-11-22

- Fixed the code to detect whether the filename includes a version number that looks like an
Expand Down
16 changes: 16 additions & 0 deletions ubi-cli/tests/ubi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,22 @@ fn integration_tests() -> Result<()> {
make_exe_pathbuf(&["bin", "direnv"]),
)?;

// This project used just "mac" in the macOS release names, which `ubi` didn't look for until
// 0.2.4.
run_test(
td.path(),
ubi.as_ref(),
&[
"--project",
"wren-lang/wren-cli",
"--tag",
"0.4.0",
"--exe",
"wren_cli",
],
make_exe_pathbuf(&["bin", "wren_cli"]),
)?;

Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion ubi/src/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) fn linux_re() -> &'static Lazy<Regex> {
}

pub(crate) fn macos_re() -> &'static Lazy<Regex> {
regex!(r"(?i:(?:\b|_)(?:darwin|macos|osx)(?:\b|_))")
regex!(r"(?i:(?:\b|_)(?:darwin|mac(?:os)?|osx)(?:\b|_))")
}

pub(crate) fn netbsd_re() -> &'static Lazy<Regex> {
Expand Down
7 changes: 7 additions & 0 deletions ubi/src/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,13 @@ mod test {
0 ;
"aarch64-apple-darwin - pick one asset"
)]
#[test_case(
"aarch64-apple-darwin",
&["project-Linux-x86-64.tar.gz", "project-Mac-x86-64.tar.gz"],
None,
1 ;
"aarch64-apple-darwin - pick asset with 'mac' in the name"
)]
#[test_case(
"aarch64-apple-darwin",
&["project-Macos-x86-64.tar.gz", "project-Macos-aarch64.tar.gz"],
Expand Down

0 comments on commit 7cabd20

Please sign in to comment.