2024-07-25 09:02:43 +01:00
|
|
|
use crate::config::{
|
2024-05-29 19:22:05 +01:00
|
|
|
ApiToken, BranchName, ForgeAlias, ForgeDetails, ForgeType, Hostname, RepoAlias, RepoBranches,
|
2024-05-22 08:41:30 +01:00
|
|
|
RepoConfig, RepoConfigSource, RepoPath, User,
|
2024-04-16 22:21:55 +01:00
|
|
|
};
|
|
|
|
|
2024-08-06 07:43:28 +01:00
|
|
|
#[must_use]
|
2024-04-16 22:21:55 +01:00
|
|
|
pub fn forge_details(n: u32, forge_type: ForgeType) -> ForgeDetails {
|
2024-05-15 07:55:05 +01:00
|
|
|
ForgeDetails::new(
|
|
|
|
forge_name(n),
|
2024-04-16 22:21:55 +01:00
|
|
|
forge_type,
|
2024-05-15 07:55:05 +01:00
|
|
|
hostname(n),
|
|
|
|
user(n),
|
|
|
|
api_token(n),
|
|
|
|
)
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
2024-08-06 07:43:28 +01:00
|
|
|
pub(crate) fn api_token(n: u32) -> ApiToken {
|
|
|
|
ApiToken::new(format!("api-{n}").into())
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
2024-08-06 07:43:28 +01:00
|
|
|
pub(crate) fn user(n: u32) -> User {
|
|
|
|
User::new(format!("user-{n}"))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
2024-08-06 07:43:28 +01:00
|
|
|
pub(crate) fn hostname(n: u32) -> Hostname {
|
|
|
|
Hostname::new(format!("hostname-{n}"))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
2024-08-06 07:43:28 +01:00
|
|
|
pub(crate) fn forge_name(n: u32) -> ForgeAlias {
|
|
|
|
ForgeAlias::new(format!("forge-name-{n}"))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
2024-08-06 07:43:28 +01:00
|
|
|
pub(crate) fn branch_name(n: u32) -> BranchName {
|
|
|
|
BranchName::new(format!("branch-name-{n}"))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
2024-08-06 07:43:28 +01:00
|
|
|
pub(crate) fn repo_path(n: u32) -> RepoPath {
|
|
|
|
RepoPath::new(format!("repo-path-{n}"))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
2024-08-06 07:43:28 +01:00
|
|
|
pub(crate) fn repo_alias(n: u32) -> RepoAlias {
|
|
|
|
RepoAlias::new(format!("repo-alias-{n}"))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
2024-08-06 07:43:28 +01:00
|
|
|
#[must_use]
|
2024-05-08 07:34:35 +01:00
|
|
|
pub fn repo_config(n: u32, source: RepoConfigSource) -> RepoConfig {
|
2024-05-15 07:55:05 +01:00
|
|
|
RepoConfig::new(
|
|
|
|
RepoBranches::new(format!("main-{n}"), format!("next-{n}"), format!("dev-{n}")),
|
2024-05-08 07:34:35 +01:00
|
|
|
source,
|
2024-05-15 07:55:05 +01:00
|
|
|
)
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|