Skip to content

Commit

Permalink
Add linux fetchers to locator
Browse files Browse the repository at this point in the history
  • Loading branch information
jssblck committed Jun 25, 2024
1 parent 51d106b commit 35f006a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "locator"
version = "2.0.1"
version = "2.0.2"
edition = "2021"

[dependencies]
Expand Down
31 changes: 31 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ pub enum Fetcher {
#[strum(serialize = "hex")]
Hex,

/// Linux Alpine packages.
#[strum(serialize = "apk")]
#[serde(rename = "apk")]
LinuxAlpine,

/// Linux Debian packages.
#[strum(serialize = "deb")]
#[serde(rename = "deb")]
LinuxDebian,

/// Linux RPM packages.
#[strum(serialize = "rpm-generic")]
#[serde(rename = "rpm-generic")]
LinuxRpm,

/// Interacts with Maven.
#[strum(serialize = "mvn")]
Maven,
Expand Down Expand Up @@ -395,4 +410,20 @@ mod tests {
assert_eq!(package, test, "'package' must match in '{test}");
}
}

#[test]
fn serializes_linux_properly() {
assert_eq!(
r#""rpm-generic""#,
serde_json::to_string(&Fetcher::LinuxRpm).unwrap()
);
assert_eq!(
r#""deb""#,
serde_json::to_string(&Fetcher::LinuxDebian).unwrap()
);
assert_eq!(
r#""apk""#,
serde_json::to_string(&Fetcher::LinuxAlpine).unwrap()
);
}
}

0 comments on commit 35f006a

Please sign in to comment.