Skip to content

Commit 0eadd4a

Browse files
authored
Add linux fetchers to locator (#7)
1 parent 51d106b commit 0eadd4a

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "locator"
3-
version = "2.0.1"
3+
version = "2.0.2"
44
edition = "2021"
55

66
[dependencies]

src/lib.rs

+40
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,21 @@ pub enum Fetcher {
112112
#[strum(serialize = "hex")]
113113
Hex,
114114

115+
/// Linux Alpine packages.
116+
#[strum(serialize = "apk")]
117+
#[serde(rename = "apk")]
118+
LinuxAlpine,
119+
120+
/// Linux Debian packages.
121+
#[strum(serialize = "deb")]
122+
#[serde(rename = "deb")]
123+
LinuxDebian,
124+
125+
/// Linux RPM packages.
126+
#[strum(serialize = "rpm-generic")]
127+
#[serde(rename = "rpm-generic")]
128+
LinuxRpm,
129+
115130
/// Interacts with Maven.
116131
#[strum(serialize = "mvn")]
117132
Maven,
@@ -136,6 +151,10 @@ pub enum Fetcher {
136151
#[strum(serialize = "pub")]
137152
Pub,
138153

154+
/// Indicates RPM files.
155+
#[strum(serialize = "rpm")]
156+
Rpm,
157+
139158
/// Interact with Swift's package manager.
140159
#[strum(serialize = "swift")]
141160
Swift,
@@ -145,6 +164,11 @@ pub enum Fetcher {
145164
#[strum(serialize = "url")]
146165
Url,
147166

167+
/// An unresolved path dependency.
168+
#[strum(serialize = "upath")]
169+
#[serde(rename = "upath")]
170+
UnresolvedPath,
171+
148172
/// A user-specified package.
149173
#[strum(serialize = "user")]
150174
User,
@@ -395,4 +419,20 @@ mod tests {
395419
assert_eq!(package, test, "'package' must match in '{test}");
396420
}
397421
}
422+
423+
#[test]
424+
fn serializes_linux_properly() {
425+
assert_eq!(
426+
r#""rpm-generic""#,
427+
serde_json::to_string(&Fetcher::LinuxRpm).unwrap()
428+
);
429+
assert_eq!(
430+
r#""deb""#,
431+
serde_json::to_string(&Fetcher::LinuxDebian).unwrap()
432+
);
433+
assert_eq!(
434+
r#""apk""#,
435+
serde_json::to_string(&Fetcher::LinuxAlpine).unwrap()
436+
);
437+
}
398438
}

0 commit comments

Comments
 (0)