Paul Campbell
6acefda5d3
All checks were successful
Rust / build (push) Successful in 1m19s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 47s
51 lines
1.2 KiB
Rust
51 lines
1.2 KiB
Rust
use crate::config::{
|
|
ApiToken, BranchName, ForgeAlias, ForgeDetails, ForgeType, Hostname, RepoAlias, RepoBranches,
|
|
RepoConfig, RepoConfigSource, RepoPath, User,
|
|
};
|
|
|
|
#[must_use]
|
|
pub fn forge_details(n: u32, forge_type: ForgeType) -> ForgeDetails {
|
|
ForgeDetails::new(
|
|
forge_name(n),
|
|
forge_type,
|
|
hostname(n),
|
|
user(n),
|
|
api_token(n),
|
|
)
|
|
}
|
|
|
|
pub(crate) fn api_token(n: u32) -> ApiToken {
|
|
ApiToken::new(format!("api-{n}").into())
|
|
}
|
|
|
|
pub(crate) fn user(n: u32) -> User {
|
|
User::new(format!("user-{n}"))
|
|
}
|
|
|
|
pub(crate) fn hostname(n: u32) -> Hostname {
|
|
Hostname::new(format!("hostname-{n}"))
|
|
}
|
|
|
|
pub(crate) fn forge_name(n: u32) -> ForgeAlias {
|
|
ForgeAlias::new(format!("forge-name-{n}"))
|
|
}
|
|
|
|
pub(crate) fn branch_name(n: u32) -> BranchName {
|
|
BranchName::new(format!("branch-name-{n}"))
|
|
}
|
|
|
|
pub(crate) fn repo_path(n: u32) -> RepoPath {
|
|
RepoPath::new(format!("repo-path-{n}"))
|
|
}
|
|
|
|
pub(crate) fn repo_alias(n: u32) -> RepoAlias {
|
|
RepoAlias::new(format!("repo-alias-{n}"))
|
|
}
|
|
|
|
#[must_use]
|
|
pub fn repo_config(n: u32, source: RepoConfigSource) -> RepoConfig {
|
|
RepoConfig::new(
|
|
RepoBranches::new(format!("main-{n}"), format!("next-{n}"), format!("dev-{n}")),
|
|
source,
|
|
)
|
|
}
|