From 12849d5a6956372b6fd0ee300570e078c3bd9346 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Wed, 3 Jul 2024 07:42:11 +0100 Subject: [PATCH] refactor: server no longer depends directly on git crate --- README.md | 1 - crates/cli/src/main.rs | 4 ++-- crates/server-actor/src/lib.rs | 5 ++++- crates/server/Cargo.toml | 1 - crates/server/src/lib.rs | 3 +-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 86ae991..6424329 100644 --- a/README.md +++ b/README.md @@ -409,7 +409,6 @@ stateDiagram-v2 repo_actor --> actor_macros server --> config - server --> git server --> file_watcher_actor server --> server_actor diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 68e0d08..6741850 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -29,7 +29,7 @@ enum Server { fn main() { let fs = fs::new(PathBuf::default()); let net = Network::new_real(); - let repo = git_next_server::repo(); + let repository_factory = git_next_server::repository_factory(); let commands = Commands::parse(); match commands.command { @@ -42,7 +42,7 @@ fn main() { } Server::Start => { let sleep_duration = std::time::Duration::from_secs(10); - git_next_server::start(fs, net, repo, sleep_duration); + git_next_server::start(fs, net, repository_factory, sleep_duration); } }, } diff --git a/crates/server-actor/src/lib.rs b/crates/server-actor/src/lib.rs index dc13915..9355927 100644 --- a/crates/server-actor/src/lib.rs +++ b/crates/server-actor/src/lib.rs @@ -5,7 +5,7 @@ use git_next_config as config; use git_next_config::server::{ServerConfig, ServerStorage, Webhook}; use git_next_config::{ForgeAlias, ForgeConfig, GitDir, RepoAlias, ServerRepoConfig}; use git_next_file_watcher_actor::FileUpdated; -use git_next_git::{repository::RepositoryFactory, Generation, RepoDetails}; +use git_next_git::{Generation, RepoDetails}; use git_next_repo_actor::{messages::CloneRepo, RepoActor}; use git_next_webhook_actor as webhook; use kxio::{fs::FileSystem, network::Network}; @@ -13,6 +13,9 @@ use std::path::PathBuf; use tracing::{error, info, warn}; use webhook::{AddWebhookRecipient, ShutdownWebhook, WebhookActor, WebhookRouter}; +pub use git::repository::{real as repository_factory, RepositoryFactory}; +use git_next_git as git; + message!(ReceiveServerConfig: ServerConfig: "Notification of newly loaded server configuration. This message will prompt the `git-next` server to stop and restart all repo-actors. diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index ef426be..a588405 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -5,7 +5,6 @@ edition = { workspace = true } [dependencies] git-next-config = { workspace = true } -git-next-git = { workspace = true } git-next-file-watcher-actor = { workspace = true } git-next-server-actor = { workspace = true } diff --git a/crates/server/src/lib.rs b/crates/server/src/lib.rs index 54ed444..6d0efa6 100644 --- a/crates/server/src/lib.rs +++ b/crates/server/src/lib.rs @@ -1,14 +1,13 @@ // use actix::prelude::*; use git_next_file_watcher_actor::{FileUpdated, FileWatcher}; -use git_next_git::repository::RepositoryFactory; use git_next_server_actor::Server; use kxio::{fs::FileSystem, network::Network}; use std::path::PathBuf; use tracing::{error, info}; use tracing_subscriber::EnvFilter; -pub use git_next_git::repository::real as repo; +pub use git_next_server_actor::{repository_factory, RepositoryFactory}; pub fn init(fs: FileSystem) { let file_name = "git-next-server.toml";