-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of release artifacts where the platform looks like an ex…
…tension The `direnv` project does this, with names like "direnv.linux-amd64".
- Loading branch information
Showing
6 changed files
with
87 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ mod arch; | |
mod extension; | ||
mod fetcher; | ||
mod installer; | ||
mod os; | ||
mod picker; | ||
mod release; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use itertools::Itertools; | ||
use lazy_regex::{regex, Lazy}; | ||
use regex::Regex; | ||
|
||
pub(crate) fn freebsd_re() -> &'static Lazy<Regex> { | ||
regex!(r"(?i:(?:\b|_)freebsd(?:\b|_))") | ||
} | ||
|
||
pub(crate) fn fuchsia() -> &'static Lazy<Regex> { | ||
regex!(r"(?i:(?:\b|_)fuchsia(?:\b|_))") | ||
} | ||
|
||
pub(crate) fn illumos_re() -> &'static Lazy<Regex> { | ||
regex!(r"(?i:(?:\b|_)illumos(?:\b|_))") | ||
} | ||
|
||
pub(crate) fn linux_re() -> &'static Lazy<Regex> { | ||
regex!(r"(?i:(?:\b|_)linux(?:\b|_|32|64))") | ||
} | ||
|
||
pub(crate) fn macos_re() -> &'static Lazy<Regex> { | ||
regex!(r"(?i:(?:\b|_)(?:darwin|macos|osx)(?:\b|_))") | ||
} | ||
|
||
pub(crate) fn netbsd_re() -> &'static Lazy<Regex> { | ||
regex!(r"(?i:(?:\b|_)netbsd(?:\b|_))") | ||
} | ||
|
||
pub(crate) fn solaris_re() -> &'static Lazy<Regex> { | ||
regex!(r"(?i:(?:\b|_)solaris(?:\b|_))") | ||
} | ||
|
||
pub(crate) fn windows_re() -> &'static Lazy<Regex> { | ||
regex!(r"(?i:(?:\b|_)win(?:32|64|dows)?(?:\b|_))") | ||
} | ||
|
||
pub(crate) fn all_oses_re() -> Regex { | ||
Regex::new( | ||
&[ | ||
freebsd_re(), | ||
fuchsia(), | ||
illumos_re(), | ||
linux_re(), | ||
macos_re(), | ||
netbsd_re(), | ||
solaris_re(), | ||
windows_re(), | ||
] | ||
.iter() | ||
.map(|r| format!("({})", r.as_str())) | ||
.join("|"), | ||
) | ||
.unwrap() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters