2024-04-16 22:21:55 +01:00
|
|
|
use crate::server::config::{
|
|
|
|
ApiToken, BranchName, ForgeDetails, ForgeName, ForgeType, Hostname, RepoAlias, RepoBranches,
|
|
|
|
RepoConfig, RepoDetails, RepoPath, User,
|
|
|
|
};
|
|
|
|
|
|
|
|
pub fn forge_details(n: u32, forge_type: ForgeType) -> ForgeDetails {
|
|
|
|
ForgeDetails {
|
|
|
|
name: forge_name(n),
|
|
|
|
forge_type,
|
|
|
|
hostname: hostname(n),
|
|
|
|
user: user(n),
|
|
|
|
token: api_token(n),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn api_token(n: u32) -> ApiToken {
|
|
|
|
ApiToken::from(format!("api-{}", n))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn user(n: u32) -> User {
|
|
|
|
User(format!("user-{}", n))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn hostname(n: u32) -> Hostname {
|
|
|
|
Hostname(format!("hostname-{}", n))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn forge_name(n: u32) -> ForgeName {
|
|
|
|
ForgeName(format!("forge-name-{}", n))
|
|
|
|
}
|
|
|
|
pub fn repo_details(n: u32, forge: ForgeDetails, config: Option<RepoConfig>) -> RepoDetails {
|
|
|
|
RepoDetails {
|
|
|
|
name: repo_alias(n),
|
2024-04-20 20:49:38 +01:00
|
|
|
repo_path: repo_path(n),
|
2024-04-16 22:21:55 +01:00
|
|
|
branch: branch_name(n),
|
|
|
|
forge,
|
|
|
|
config,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn branch_name(n: u32) -> BranchName {
|
|
|
|
BranchName(format!("branch-name-{}", n))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn repo_path(n: u32) -> RepoPath {
|
|
|
|
RepoPath(format!("repo-path-{}", n))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn repo_alias(n: u32) -> RepoAlias {
|
|
|
|
RepoAlias(format!("repo-alias-{}", n))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn config(n: u32) -> RepoConfig {
|
|
|
|
RepoConfig::new(RepoBranches::new(
|
|
|
|
format!("main-{n}"),
|
|
|
|
format!("next-{n}"),
|
|
|
|
format!("dev-{n}"),
|
|
|
|
))
|
|
|
|
}
|