WIP: extract more crates
All checks were successful
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

This commit is contained in:
Paul Campbell 2024-05-22 08:41:30 +01:00
parent 2dbd42163a
commit 943291daca
28 changed files with 173 additions and 17 deletions

View file

@ -1,6 +1,13 @@
[workspace] [workspace]
resolver = "2" resolver = "2"
members = ["crates/cli", "crates/server", "crates/config", "crates/git"] members = [
"crates/cli",
"crates/server",
"crates/config",
"crates/git",
"crates/gitforge",
"crates/repo-actor",
]
[workspace.package] [workspace.package]
version = "0.5.1" version = "0.5.1"
@ -16,6 +23,8 @@ expect_used = "warn"
git-next-server = { path = "crates/server" } git-next-server = { path = "crates/server" }
git-next-config = { path = "crates/config" } git-next-config = { path = "crates/config" }
git-next-git = { path = "crates/git" } git-next-git = { path = "crates/git" }
git-next-gitforge = { path = "crates/gitforge" }
git-next-repo-actor = { path = "crates/repo-actor" }
# CLI parsing # CLI parsing
clap = { version = "4.5", features = ["cargo", "derive"] } clap = { version = "4.5", features = ["cargo", "derive"] }

View file

@ -190,9 +190,22 @@ The following diagram shows the dependency between the crates that make up `git-
stateDiagram-v2 stateDiagram-v2
cli --> server cli --> server
cli --> git cli --> git
server --> config server --> config
server --> git server --> git
server --> gitforge
server --> repo_actor
git --> config git --> config
gitforge --> config
gitforge --> git
repo_actor --> config
repo_actor --> git
repo_actor --> gitforge
``` ```
## License ## License

View file

@ -9,9 +9,9 @@ forgejo = []
github = [] github = []
[dependencies] [dependencies]
# # logging # logging
# console-subscriber = { workspace = true } # console-subscriber = { workspace = true }
# tracing = { workspace = true } tracing = { workspace = true }
# tracing-subscriber = { workspace = true } # tracing-subscriber = { workspace = true }
# # base64 decoding # # base64 decoding
@ -21,9 +21,9 @@ github = []
# # gix = { workspace = true } # # gix = { workspace = true }
# gix = { workspace = true } # gix = { workspace = true }
# async-trait = { workspace = true } # async-trait = { workspace = true }
#
# # fs/network # fs/network
# kxio = { workspace = true } kxio = { workspace = true }
# TOML parsing # TOML parsing
serde = { workspace = true } serde = { workspace = true }
@ -47,12 +47,12 @@ derive-with = { workspace = true }
# #
# # file watcher # # file watcher
# inotify = { workspace = true } # inotify = { workspace = true }
#
# # Actors # Actors
# actix = { workspace = true } actix = { workspace = true }
# actix-rt = { workspace = true } # actix-rt = { workspace = true }
# tokio = { workspace = true } # tokio = { workspace = true }
#
[dev-dependencies] [dev-dependencies]
# # Testing # # Testing
assert2 = { workspace = true } assert2 = { workspace = true }

View file

@ -0,0 +1,64 @@
[package]
name = "git-next-gitforge"
version = { workspace = true }
edition = { workspace = true }
[features]
default = ["forgejo"]
forgejo = []
github = []
[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"

View file

@ -2,7 +2,9 @@ use git::OpenRepository;
use git_next_config::{BranchName, GitDir, RepoConfig}; use git_next_config::{BranchName, GitDir, RepoConfig};
use git_next_git::{self as git, GitRef}; use git_next_git::{self as git, GitRef};
use crate::{actors::repo::RepoActor, gitforge}; use crate::{
actors::repo::RepoActor, CommitStatus, ForgeBranchError, ForgeFileError, MessageToken,
};
struct MockForge; struct MockForge;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
@ -18,7 +20,7 @@ impl super::ForgeLike for MockForgeEnv {
"mock".to_string() "mock".to_string()
} }
async fn branches_get_all(&self) -> Result<Vec<BranchName>, gitforge::ForgeBranchError> { async fn branches_get_all(&self) -> Result<Vec<BranchName>, ForgeBranchError> {
todo!() todo!()
} }
@ -26,7 +28,7 @@ impl super::ForgeLike for MockForgeEnv {
&self, &self,
_branch: &BranchName, _branch: &BranchName,
_file_path: &str, _file_path: &str,
) -> Result<String, gitforge::ForgeFileError> { ) -> Result<String, ForgeFileError> {
todo!() todo!()
} }
@ -35,7 +37,7 @@ impl super::ForgeLike for MockForgeEnv {
_repository: OpenRepository, _repository: OpenRepository,
_repo_config: RepoConfig, _repo_config: RepoConfig,
_addr: actix::prelude::Addr<RepoActor>, _addr: actix::prelude::Addr<RepoActor>,
_message_token: gitforge::MessageToken, _message_token: MessageToken,
) { ) {
todo!() todo!()
} }
@ -50,7 +52,7 @@ impl super::ForgeLike for MockForgeEnv {
todo!() todo!()
} }
async fn commit_status(&self, _commit: &git::Commit) -> gitforge::CommitStatus { async fn commit_status(&self, _commit: &git::Commit) -> CommitStatus {
todo!() todo!()
} }

View file

@ -0,0 +1,65 @@
[package]
name = "git-next-repo-actor"
version = { workspace = true }
edition = { workspace = true }
[features]
default = ["forgejo"]
forgejo = []
github = []
[dependencies]
git-next-config = { workspace = true }
git-next-git = { workspace = true }
git-next-gitforge = { 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"

View file

@ -13,7 +13,9 @@ use git_next_git::{self as git, Generation, RepoDetails};
use kxio::network::Network; use kxio::network::Network;
use tracing::{debug, info, warn, Instrument}; use tracing::{debug, info, warn, Instrument};
use crate::{actors::repo::webhook::WebhookAuth, config::Webhook, gitforge}; // use crate::{actors::repo::webhook::WebhookAuth, config::Webhook, gitforge};
use crate::webhook::WebhookAuth;
use self::webhook::WebhookId; use self::webhook::WebhookId;

View file

@ -11,6 +11,8 @@ github = []
[dependencies] [dependencies]
git-next-config = { workspace = true } git-next-config = { workspace = true }
git-next-git = { workspace = true } git-next-git = { workspace = true }
git-next-gitforge = { workspace = true }
git-next-repo-actor = { workspace = true }
# logging # logging
console-subscriber = { workspace = true } console-subscriber = { workspace = true }

View file

@ -1,4 +1,3 @@
pub mod file_watcher; pub mod file_watcher;
pub mod repo;
pub mod server; pub mod server;
pub mod webhook; pub mod webhook;