From 35f006a40485a7d09c0306cf6622e91c8b51ee97 Mon Sep 17 00:00:00 2001 From: Jessica Black Date: Tue, 25 Jun 2024 14:44:26 -0700 Subject: [PATCH 1/2] Add linux fetchers to locator --- Cargo.toml | 2 +- src/lib.rs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 74af75e..75b3920 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "locator" -version = "2.0.1" +version = "2.0.2" edition = "2021" [dependencies] diff --git a/src/lib.rs b/src/lib.rs index 3420425..267731a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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, @@ -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() + ); + } } From 4d7e2b288a238e2aa18f852675cdff365bd376b8 Mon Sep 17 00:00:00 2001 From: Jessica Black Date: Tue, 25 Jun 2024 14:48:26 -0700 Subject: [PATCH 2/2] Add other missing fetchers --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 267731a..bef2032 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -151,6 +151,10 @@ pub enum Fetcher { #[strum(serialize = "pub")] Pub, + /// Indicates RPM files. + #[strum(serialize = "rpm")] + Rpm, + /// Interact with Swift's package manager. #[strum(serialize = "swift")] Swift, @@ -160,6 +164,11 @@ pub enum Fetcher { #[strum(serialize = "url")] Url, + /// An unresolved path dependency. + #[strum(serialize = "upath")] + #[serde(rename = "upath")] + UnresolvedPath, + /// A user-specified package. #[strum(serialize = "user")] User,