From 78c5371cd9b1327a5c6d767d568f3c4d7ec53c79 Mon Sep 17 00:00:00 2001 From: Kattouf Date: Tue, 17 Dec 2024 14:47:08 +0700 Subject: [PATCH] Make the macOS regex allow `macosx` --- Changes.md | 5 +++++ ubi/src/os.rs | 2 +- ubi/src/picker.rs | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Changes.md b/Changes.md index 5b2d0ed..b0d504f 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,8 @@ +## 0.2.5 + +- When looking for macOS assets, `ubi` will now match against `macosx` in asset names, not just + `macos` and `osx`. Implemented by @kattouf (Vasiliy Kattouf). GH #80. + ## 0.2.4 - 2024-11-24 - `ubi` will now look for just "mac" or "Mac" in a filename when running on macOS. Previously, `ubi` diff --git a/ubi/src/os.rs b/ubi/src/os.rs index 12d0d06..640adf6 100644 --- a/ubi/src/os.rs +++ b/ubi/src/os.rs @@ -19,7 +19,7 @@ pub(crate) fn linux_re() -> &'static Lazy { } pub(crate) fn macos_re() -> &'static Lazy { - regex!(r"(?i:(?:\b|_)(?:darwin|mac(?:os)?|osx)(?:\b|_))") + regex!(r"(?i:(?:\b|_)(?:darwin|mac(?:osx?)?|osx)(?:\b|_))") } pub(crate) fn netbsd_re() -> &'static Lazy { diff --git a/ubi/src/picker.rs b/ubi/src/picker.rs index 8bcb295..c4214fd 100644 --- a/ubi/src/picker.rs +++ b/ubi/src/picker.rs @@ -446,6 +446,13 @@ mod test { 1 ; "aarch64-apple-darwin - pick asset with 'mac' in the name" )] + #[test_case( + "aarch64-apple-darwin", + &["project-Linux-x86-64.tar.gz", "project-Macosx-x86-64.tar.gz"], + None, + 1 ; + "aarch64-apple-darwin - pick asset with 'macosx' in the name" + )] #[test_case( "aarch64-apple-darwin", &["project-Macos-x86-64.tar.gz", "project-Macos-aarch64.tar.gz"],