Paul Campbell
e759e495fd
All checks were successful
Rust / build (push) Successful in 6m21s
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 2m9s
The default is 25. Closes kemitix/git-next#121
32 lines
835 B
Rust
32 lines
835 B
Rust
//
|
|
use git_next_core::git::{ForgeLike, RepoDetails};
|
|
|
|
#[cfg(feature = "forgejo")]
|
|
use git_next_forge_forgejo::ForgeJo;
|
|
|
|
#[cfg(feature = "github")]
|
|
use git_next_forge_github::Github;
|
|
|
|
use kxio::network::Network;
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct Forge;
|
|
|
|
impl Forge {
|
|
pub fn create(repo_details: RepoDetails, net: Network) -> Box<dyn ForgeLike> {
|
|
match repo_details.forge.forge_type() {
|
|
#[cfg(feature = "forgejo")]
|
|
git_next_core::ForgeType::ForgeJo => Box::new(ForgeJo::new(repo_details, net)),
|
|
#[cfg(feature = "github")]
|
|
git_next_core::ForgeType::GitHub => Box::new(Github::new(repo_details, net)),
|
|
_ => {
|
|
drop(repo_details);
|
|
drop(net);
|
|
unreachable!();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
pub mod tests;
|