mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-22 02:16:30 +00:00
Codeberg support (#134)
This commit is contained in:
parent
e8fbb00ada
commit
8bdee6b770
3 changed files with 18 additions and 4 deletions
|
@ -13,7 +13,7 @@ We currently support projects and crates hosted on crates.io, Github, Gitlab, Bi
|
||||||
To analyze the state of your dependencies you can use the following URLs:
|
To analyze the state of your dependencies you can use the following URLs:
|
||||||
|
|
||||||
- for projects on crates.io: `https://deps.rs/crate/<NAME>`
|
- for projects on crates.io: `https://deps.rs/crate/<NAME>`
|
||||||
- for projects on Github, Gitlab, Bitbucket, or SourceHut: `https://deps.rs/repo/<HOSTER>/<USER>/<REPO>` (where `<HOSTER>` is either `github`, `gitlab`, `bitbucket`, or `sourcehut`)
|
- for projects on Github, Gitlab, Bitbucket, SourceHut, or Codeberg: `https://deps.rs/repo/<HOSTER>/<USER>/<REPO>` (where `<HOSTER>` is either `github`, `gitlab`, `bitbucket`, `sourcehut`, or `codeberg`)
|
||||||
|
|
||||||
On the analysis page, you will also find the markdown code to include a fancy badge in your project README so visitors (and you) can see at a glance if your dependencies are still up to date!
|
On the analysis page, you will also find the markdown code to include a fancy badge in your project README so visitors (and you) can see at a glance if your dependencies are still up to date!
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ pub enum RepoSite {
|
||||||
Gitlab,
|
Gitlab,
|
||||||
Bitbucket,
|
Bitbucket,
|
||||||
Sourcehut,
|
Sourcehut,
|
||||||
|
Codeberg,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RepoSite {
|
impl RepoSite {
|
||||||
|
@ -64,6 +65,7 @@ impl RepoSite {
|
||||||
RepoSite::Gitlab => "https://gitlab.com",
|
RepoSite::Gitlab => "https://gitlab.com",
|
||||||
RepoSite::Bitbucket => "https://bitbucket.org",
|
RepoSite::Bitbucket => "https://bitbucket.org",
|
||||||
RepoSite::Sourcehut => "https://git.sr.ht",
|
RepoSite::Sourcehut => "https://git.sr.ht",
|
||||||
|
RepoSite::Codeberg => "https://codeberg.org",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +75,7 @@ impl RepoSite {
|
||||||
RepoSite::Gitlab => "https://gitlab.com",
|
RepoSite::Gitlab => "https://gitlab.com",
|
||||||
RepoSite::Bitbucket => "https://bitbucket.org",
|
RepoSite::Bitbucket => "https://bitbucket.org",
|
||||||
RepoSite::Sourcehut => "https://git.sr.ht",
|
RepoSite::Sourcehut => "https://git.sr.ht",
|
||||||
|
RepoSite::Codeberg => "https://codeberg.org",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +84,7 @@ impl RepoSite {
|
||||||
RepoSite::Github => "HEAD",
|
RepoSite::Github => "HEAD",
|
||||||
RepoSite::Gitlab | RepoSite::Bitbucket => "raw/HEAD",
|
RepoSite::Gitlab | RepoSite::Bitbucket => "raw/HEAD",
|
||||||
RepoSite::Sourcehut => "blob/HEAD",
|
RepoSite::Sourcehut => "blob/HEAD",
|
||||||
|
RepoSite::Codeberg => "raw",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,6 +98,7 @@ impl FromStr for RepoSite {
|
||||||
"gitlab" => Ok(RepoSite::Gitlab),
|
"gitlab" => Ok(RepoSite::Gitlab),
|
||||||
"bitbucket" => Ok(RepoSite::Bitbucket),
|
"bitbucket" => Ok(RepoSite::Bitbucket),
|
||||||
"sourcehut" => Ok(RepoSite::Sourcehut),
|
"sourcehut" => Ok(RepoSite::Sourcehut),
|
||||||
|
"codeberg" => Ok(RepoSite::Codeberg),
|
||||||
_ => Err(anyhow!("unknown repo site identifier")),
|
_ => Err(anyhow!("unknown repo site identifier")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,6 +111,7 @@ impl AsRef<str> for RepoSite {
|
||||||
RepoSite::Gitlab => "gitlab",
|
RepoSite::Gitlab => "gitlab",
|
||||||
RepoSite::Bitbucket => "bitbucket",
|
RepoSite::Bitbucket => "bitbucket",
|
||||||
RepoSite::Sourcehut => "sourcehut",
|
RepoSite::Sourcehut => "sourcehut",
|
||||||
|
RepoSite::Codeberg => "codeberg",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,5 +207,13 @@ mod tests {
|
||||||
);
|
);
|
||||||
assert_eq!(out.to_string(), exp);
|
assert_eq!(out.to_string(), exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (input, expected) in &paths {
|
||||||
|
let repo = RepoPath::from_parts("codeberg", "deps-rs", "deps.rs").unwrap();
|
||||||
|
let out = repo.to_usercontent_file_url(RelativePath::new(input));
|
||||||
|
|
||||||
|
let exp = format!("https://codeberg.org/deps-rs/deps.rs/raw/{}", expected);
|
||||||
|
assert_eq!(out.to_string(), exp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,9 +126,9 @@ fn get_site_icon(site: &RepoSite) -> (FaType, &'static str) {
|
||||||
RepoSite::Github => (FaType::Brands, "github"),
|
RepoSite::Github => (FaType::Brands, "github"),
|
||||||
RepoSite::Gitlab => (FaType::Brands, "gitlab"),
|
RepoSite::Gitlab => (FaType::Brands, "gitlab"),
|
||||||
RepoSite::Bitbucket => (FaType::Brands, "bitbucket"),
|
RepoSite::Bitbucket => (FaType::Brands, "bitbucket"),
|
||||||
// FIXME: There is no brands/sourcehut icon, so just use a regular
|
// FIXME: There is no brands/{sourcehut, codeberg} icon, so just use a
|
||||||
// circle which looks pretty much like sr.ht's circle.
|
// regular circle which looks close enough.
|
||||||
RepoSite::Sourcehut => (FaType::Regular, "circle"),
|
RepoSite::Sourcehut | RepoSite::Codeberg => (FaType::Regular, "circle"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue