2024-05-11 19:46:20 +01:00
|
|
|
use git_next_config::{
|
|
|
|
ApiToken, BranchName, ForgeDetails, ForgeName, ForgeType, GitDir, Hostname, RepoAlias,
|
|
|
|
RepoBranches, RepoConfig, RepoConfigSource, RepoPath, User,
|
2024-04-16 22:21:55 +01:00
|
|
|
};
|
|
|
|
|
2024-05-11 19:46:20 +01:00
|
|
|
use git_next_git::{Generation, RepoDetails};
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pub fn api_token(n: u32) -> ApiToken {
|
2024-05-15 07:55:05 +01:00
|
|
|
ApiToken::new(format!("api-{}", n).into())
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn user(n: u32) -> User {
|
2024-05-15 07:55:05 +01:00
|
|
|
User::new(format!("user-{}", n))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn hostname(n: u32) -> Hostname {
|
2024-05-14 07:59:31 +01:00
|
|
|
Hostname::new(format!("hostname-{}", n))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn forge_name(n: u32) -> ForgeName {
|
2024-05-15 07:55:05 +01:00
|
|
|
ForgeName::new(format!("forge-name-{}", n))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
2024-04-21 18:48:49 +01:00
|
|
|
pub fn repo_details(
|
|
|
|
n: u32,
|
2024-05-11 19:46:20 +01:00
|
|
|
generation: Generation,
|
2024-04-21 18:48:49 +01:00
|
|
|
forge: ForgeDetails,
|
2024-04-21 19:33:18 +01:00
|
|
|
repo_config: Option<RepoConfig>,
|
2024-04-23 07:09:30 +01:00
|
|
|
gitdir: GitDir,
|
2024-04-21 18:48:49 +01:00
|
|
|
) -> RepoDetails {
|
2024-04-16 22:21:55 +01:00
|
|
|
RepoDetails {
|
2024-05-07 08:17:29 +01:00
|
|
|
generation,
|
2024-04-23 06:50:52 +01:00
|
|
|
repo_alias: repo_alias(n),
|
2024-04-20 20:49:38 +01:00
|
|
|
repo_path: repo_path(n),
|
2024-04-21 18:48:49 +01:00
|
|
|
gitdir,
|
2024-04-16 22:21:55 +01:00
|
|
|
branch: branch_name(n),
|
|
|
|
forge,
|
2024-04-21 19:33:18 +01:00
|
|
|
repo_config,
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn branch_name(n: u32) -> BranchName {
|
2024-05-12 22:27:20 +01:00
|
|
|
BranchName::new(format!("branch-name-{}", n))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn repo_path(n: u32) -> RepoPath {
|
2024-05-15 07:55:05 +01:00
|
|
|
RepoPath::new(format!("repo-path-{}", n))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn repo_alias(n: u32) -> RepoAlias {
|
2024-05-14 07:59:31 +01:00
|
|
|
RepoAlias::new(format!("repo-alias-{}", n))
|
2024-04-16 22:21:55 +01:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|