forked from kemitix/git-next
refactor: extract forge-forgejo crate
This commit is contained in:
parent
9e37c073c2
commit
5253e136cc
9 changed files with 72 additions and 17 deletions
|
@ -6,6 +6,7 @@ members = [
|
|||
"crates/config",
|
||||
"crates/git",
|
||||
"crates/forge",
|
||||
"crates/forge-forgejo",
|
||||
"crates/repo-actor",
|
||||
]
|
||||
|
||||
|
@ -24,6 +25,7 @@ git-next-server = { path = "crates/server" }
|
|||
git-next-config = { path = "crates/config" }
|
||||
git-next-git = { path = "crates/git" }
|
||||
git-next-forge = { path = "crates/forge" }
|
||||
git-next-forge-forgejo = { path = "crates/forge-forgejo" }
|
||||
git-next-repo-actor = { path = "crates/repo-actor" }
|
||||
|
||||
# CLI parsing
|
||||
|
|
59
crates/forge-forgejo/Cargo.toml
Normal file
59
crates/forge-forgejo/Cargo.toml
Normal file
|
@ -0,0 +1,59 @@
|
|||
[package]
|
||||
name = "git-next-forge-forgejo"
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
git-next-config = { workspace = true }
|
||||
git-next-git = { workspace = true }
|
||||
|
||||
# logging
|
||||
console-subscriber = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
|
||||
# base64 decoding
|
||||
base64 = { workspace = true }
|
||||
|
||||
# git
|
||||
async-trait = { workspace = true }
|
||||
|
||||
# fs/network
|
||||
kxio = { workspace = true }
|
||||
|
||||
# TOML parsing
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
toml = { workspace = true }
|
||||
|
||||
# Secrets and Password
|
||||
secrecy = { workspace = true }
|
||||
|
||||
# Conventional Commit check
|
||||
git-conventional = { workspace = true }
|
||||
|
||||
# Webhooks
|
||||
bytes = { workspace = true }
|
||||
ulid = { workspace = true }
|
||||
warp = { workspace = true }
|
||||
|
||||
# boilerplate
|
||||
derive_more = { workspace = true }
|
||||
|
||||
# file watcher
|
||||
inotify = { workspace = true }
|
||||
|
||||
# # Actors
|
||||
# actix = { workspace = true }
|
||||
# actix-rt = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
# Testing
|
||||
assert2 = { workspace = true }
|
||||
|
||||
[lints.clippy]
|
||||
nursery = { level = "warn", priority = -1 }
|
||||
# pedantic = "warn"
|
||||
unwrap_used = "warn"
|
||||
expect_used = "warn"
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
use crate as forge;
|
||||
use crate as forgejo;
|
||||
use git::ForgeLike as _;
|
||||
use git_next_config as config;
|
||||
use git_next_git as git;
|
||||
|
@ -8,7 +8,7 @@ use kxio::network;
|
|||
use tracing::{debug, error, info, warn};
|
||||
|
||||
pub async fn validate_positions(
|
||||
forge: &forge::forgejo::ForgeJoEnv,
|
||||
forge: &forgejo::ForgeJo,
|
||||
repository: &git::OpenRepository,
|
||||
repo_config: config::RepoConfig,
|
||||
) -> git::validation::Result {
|
|
@ -4,7 +4,7 @@ use git_next_git as git;
|
|||
use kxio::network::{self, Network};
|
||||
use tracing::{error, warn};
|
||||
|
||||
pub(super) async fn contents_get(
|
||||
pub async fn contents_get(
|
||||
repo_details: &git::RepoDetails,
|
||||
net: &Network,
|
||||
branch: &config::BranchName,
|
|
@ -7,19 +7,14 @@ use git_next_git as git;
|
|||
use kxio::network::{self, Network};
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
struct ForgeJo;
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ForgeJoEnv {
|
||||
pub struct ForgeJo {
|
||||
repo_details: git::RepoDetails,
|
||||
net: Network,
|
||||
repo: git::Repository,
|
||||
}
|
||||
impl ForgeJoEnv {
|
||||
pub(super) const fn new(
|
||||
repo_details: git::RepoDetails,
|
||||
net: Network,
|
||||
repo: git::Repository,
|
||||
) -> Self {
|
||||
impl ForgeJo {
|
||||
pub const fn new(repo_details: git::RepoDetails, net: Network, repo: git::Repository) -> Self {
|
||||
Self {
|
||||
repo_details,
|
||||
net,
|
||||
|
@ -28,7 +23,7 @@ impl ForgeJoEnv {
|
|||
}
|
||||
}
|
||||
#[async_trait::async_trait]
|
||||
impl git::ForgeLike for ForgeJoEnv {
|
||||
impl git::ForgeLike for ForgeJo {
|
||||
fn name(&self) -> String {
|
||||
"forgejo".to_string()
|
||||
}
|
|
@ -11,6 +11,7 @@ github = []
|
|||
[dependencies]
|
||||
git-next-config = { workspace = true }
|
||||
git-next-git = { workspace = true }
|
||||
git-next-forge-forgejo = { workspace = true }
|
||||
|
||||
# logging
|
||||
console-subscriber = { workspace = true }
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
use git_next_forge_forgejo as forgejo;
|
||||
use git_next_git as git;
|
||||
use kxio::network::Network;
|
||||
|
||||
#[cfg(feature = "forgejo")]
|
||||
mod forgejo;
|
||||
|
||||
#[cfg(feature = "github")]
|
||||
mod github;
|
||||
|
||||
|
@ -16,7 +14,7 @@ pub enum Forge {
|
|||
Mock(mock_forge::MockForgeEnv),
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[cfg(feature = "forgejo")]
|
||||
ForgeJo(forgejo::ForgeJoEnv),
|
||||
ForgeJo(forgejo::ForgeJo),
|
||||
#[cfg(feature = "github")]
|
||||
Github(github::GithubEnv),
|
||||
}
|
||||
|
@ -30,7 +28,7 @@ impl Forge {
|
|||
net: Network,
|
||||
repo: git::Repository,
|
||||
) -> Self {
|
||||
Self::ForgeJo(forgejo::ForgeJoEnv::new(repo_details, net, repo))
|
||||
Self::ForgeJo(forgejo::ForgeJo::new(repo_details, net, repo))
|
||||
}
|
||||
#[cfg(feature = "github")]
|
||||
pub const fn new_github(net: Network) -> Self {
|
||||
|
|
Loading…
Reference in a new issue