1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

wezterm: teach updater about setup.exe

This commit is contained in:
Wez Furlong 2020-05-25 12:55:59 -07:00
parent f57338edc7
commit 3d1b52267e

View File

@ -55,11 +55,13 @@ pub enum AssetKind {
FedoraRpm(DistVers),
MacOSZip,
WindowsZip,
WindowsSetupExe,
Unknown,
}
fn classify_asset_name(name: &str) -> AssetKind {
let winzip = Regex::new(r"WezTerm-windows-.*\.zip$").unwrap();
let winsetup = Regex::new(r"WezTerm-.*-setup.exe$").unwrap();
let maczip = Regex::new(r"WezTerm-macos-.*\.zip$").unwrap();
let appimage = Regex::new(r"WezTerm-.*\.AppImage$").unwrap();
let appimage_zsync = Regex::new(r"WezTerm-.*\.AppImage\.zsync$").unwrap();
@ -94,6 +96,8 @@ fn classify_asset_name(name: &str) -> AssetKind {
if winzip.is_match(name) {
AssetKind::WindowsZip
} else if winsetup.is_match(name) {
AssetKind::WindowsSetupExe
} else if maczip.is_match(name) {
AssetKind::MacOSZip
} else if appimage.is_match(name) {
@ -282,6 +286,14 @@ mod test {
classify_asset_name("WezTerm-windows-nightly.zip"),
AssetKind::WindowsZip
);
assert_eq!(
classify_asset_name("WezTerm-nightly-setup.exe"),
AssetKind::WindowsSetupExe
);
assert_eq!(
classify_asset_name("WezTerm-20200505-090057-31c6155f-setup.exe"),
AssetKind::WindowsSetupExe
);
assert_eq!(
classify_asset_name("WezTerm-macos-20200505-090057-31c6155f.zip"),