diff --git a/Cargo.toml b/Cargo.toml index ebfc572..eed6b4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/crates/forge-forgejo/Cargo.toml b/crates/forge-forgejo/Cargo.toml new file mode 100644 index 0000000..f5c551e --- /dev/null +++ b/crates/forge-forgejo/Cargo.toml @@ -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" diff --git a/crates/forge/src/forgejo/branch/get_all.rs b/crates/forge-forgejo/src/branch/get_all.rs similarity index 100% rename from crates/forge/src/forgejo/branch/get_all.rs rename to crates/forge-forgejo/src/branch/get_all.rs diff --git a/crates/forge/src/forgejo/branch/mod.rs b/crates/forge-forgejo/src/branch/mod.rs similarity index 100% rename from crates/forge/src/forgejo/branch/mod.rs rename to crates/forge-forgejo/src/branch/mod.rs diff --git a/crates/forge/src/forgejo/branch/validate_positions.rs b/crates/forge-forgejo/src/branch/validate_positions.rs similarity index 99% rename from crates/forge/src/forgejo/branch/validate_positions.rs rename to crates/forge-forgejo/src/branch/validate_positions.rs index 087c90f..286fcaa 100644 --- a/crates/forge/src/forgejo/branch/validate_positions.rs +++ b/crates/forge-forgejo/src/branch/validate_positions.rs @@ -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 { diff --git a/crates/forge/src/forgejo/file.rs b/crates/forge-forgejo/src/file.rs similarity index 98% rename from crates/forge/src/forgejo/file.rs rename to crates/forge-forgejo/src/file.rs index f20a21d..1b5af3c 100644 --- a/crates/forge/src/forgejo/file.rs +++ b/crates/forge-forgejo/src/file.rs @@ -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, diff --git a/crates/forge/src/forgejo/mod.rs b/crates/forge-forgejo/src/lib.rs similarity index 94% rename from crates/forge/src/forgejo/mod.rs rename to crates/forge-forgejo/src/lib.rs index 8624d5d..cbac501 100644 --- a/crates/forge/src/forgejo/mod.rs +++ b/crates/forge-forgejo/src/lib.rs @@ -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() } diff --git a/crates/forge/Cargo.toml b/crates/forge/Cargo.toml index c243615..2d49389 100644 --- a/crates/forge/Cargo.toml +++ b/crates/forge/Cargo.toml @@ -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 } diff --git a/crates/forge/src/lib.rs b/crates/forge/src/lib.rs index f71bd42..e4dddf8 100644 --- a/crates/forge/src/lib.rs +++ b/crates/forge/src/lib.rs @@ -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 {