refactor: use given::a_name in config tests
All checks were successful
Rust / build (push) Successful in 1m17s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
ci/woodpecker/cron/cron-docker-builder Pipeline was successful

This commit is contained in:
Paul Campbell 2024-06-08 15:06:34 +01:00
parent aa817a8e95
commit b5c0f5bd36
6 changed files with 458 additions and 399 deletions

View file

@ -57,6 +57,7 @@ actix = { workspace = true }
[dev-dependencies] [dev-dependencies]
# # Testing # # Testing
assert2 = { workspace = true } assert2 = { workspace = true }
rand = { workspace = true }
pretty_assertions = { workspace = true } pretty_assertions = { workspace = true }
[lints.clippy] [lints.clippy]

View file

@ -1,9 +1,9 @@
use std::path::PathBuf; use std::path::PathBuf;
use derive_more::{AsRef, Constructor, Display};
/// The name of a Forge to connect to /// The name of a Forge to connect to
#[derive( #[derive(Clone, Default, Debug, Hash, PartialEq, Eq, Constructor, Display, AsRef)]
Clone, Default, Debug, Hash, PartialEq, Eq, derive_more::Constructor, derive_more::Display,
)]
pub struct ForgeAlias(String); pub struct ForgeAlias(String);
impl From<&ForgeAlias> for PathBuf { impl From<&ForgeAlias> for PathBuf {
fn from(value: &ForgeAlias) -> Self { fn from(value: &ForgeAlias) -> Self {

View file

@ -13,6 +13,6 @@ pub enum ForgeType {
} }
impl std::fmt::Display for ForgeType { impl std::fmt::Display for ForgeType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", format!("{:?}", self).to_lowercase()) write!(f, "{:?}", self)
} }
} }

View file

@ -13,8 +13,8 @@ use std::path::PathBuf;
)] )]
pub struct GitDir(PathBuf); pub struct GitDir(PathBuf);
impl GitDir { impl GitDir {
pub fn new(pathbuf: &std::path::Path) -> Self { pub fn new(path: &std::path::Path) -> Self {
Self(pathbuf.to_path_buf()) Self(path.to_path_buf())
} }
pub const fn pathbuf(&self) -> &PathBuf { pub const fn pathbuf(&self) -> &PathBuf {

View file

@ -91,6 +91,9 @@ impl Webhook {
let base_url = &self.url; let base_url = &self.url;
WebhookUrl(format!("{base_url}/{forge_alias}/{repo_alias}")) WebhookUrl(format!("{base_url}/{forge_alias}/{repo_alias}"))
} }
pub fn base_url(&self) -> &str {
&self.url
}
} }
/// The URL for the webhook where forges should send their updates /// The URL for the webhook where forges should send their updates

File diff suppressed because it is too large Load diff