Skip to content

Commit

Permalink
Add linux fetchers to locator (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
jssblck authored Jun 25, 2024
1 parent 51d106b commit 0eadd4a
Show file tree
Hide file tree
Showing 2 changed files with 41 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
40 changes: 40 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 All @@ -136,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,
Expand All @@ -145,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,
Expand Down Expand Up @@ -395,4 +419,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 0eadd4a

Please sign in to comment.