diff --git a/Cargo.toml b/Cargo.toml index 65e6c68..b458a73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ "crates/repo-actor", "crates/webhook-actor", "crates/actor-macros", + "crates/file-watcher-actor", ] [workspace.package] @@ -32,6 +33,7 @@ git-next-forge-forgejo = { path = "crates/forge-forgejo" } git-next-forge-github = { path = "crates/forge-github" } git-next-repo-actor = { path = "crates/repo-actor" } git-next-webhook-actor = { path = "crates/webhook-actor" } +git-next-file-watcher-actor = { path = "crates/file-watcher-actor" } git-next-actor-macros = { path = "crates/actor-macros" } # CLI parsing diff --git a/crates/actor-macros/Cargo.toml b/crates/actor-macros/Cargo.toml index 616995d..e98c511 100644 --- a/crates/actor-macros/Cargo.toml +++ b/crates/actor-macros/Cargo.toml @@ -4,26 +4,9 @@ version = { workspace = true } edition = { workspace = true } [dependencies] -# git-next-config = { workspace = true } -# git-next-repo-actor = { workspace = true } -# -# # logging -# tracing = { workspace = true } -# -# # Webhooks -# bytes = { workspace = true } -# warp = { workspace = true } -# -# # boilerplate -# derive_more = { workspace = true } - # Actors actix = { workspace = true } -[dev-dependencies] -# Testing -# assert2 = { workspace = true } - [lints.clippy] nursery = { level = "warn", priority = -1 } # pedantic = "warn" diff --git a/crates/file-watcher-actor/Cargo.toml b/crates/file-watcher-actor/Cargo.toml new file mode 100644 index 0000000..8b672c0 --- /dev/null +++ b/crates/file-watcher-actor/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "git-next-file-watcher-actor" +version = { workspace = true } +edition = { workspace = true } + +[dependencies] +# git-next-config = { workspace = true } +# git-next-repo-actor = { workspace = true } + +# logging +tracing = { workspace = true } + +# file watcher +inotify = { workspace = true } + +# Webhooks +# bytes = { workspace = true } +# warp = { workspace = true } + +# boilerplate +# derive_more = { workspace = true } +thiserror = { workspace = true } + +# Actors +actix = { 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/server/src/actors/file_watcher.rs b/crates/file-watcher-actor/src/lib.rs similarity index 100% rename from crates/server/src/actors/file_watcher.rs rename to crates/file-watcher-actor/src/lib.rs diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index 1338b73..6eba0d3 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -9,6 +9,7 @@ git-next-git = { workspace = true } git-next-forge = { workspace = true } git-next-repo-actor = { workspace = true } git-next-actor-macros = { workspace = true } +git-next-file-watcher-actor = { workspace = true } git-next-webhook-actor = { workspace = true } # logging @@ -23,10 +24,6 @@ kxio = { workspace = true } derive_more = { workspace = true } thiserror = { workspace = true } -# file watcher -inotify = { workspace = true } - -# Actors actix = { workspace = true } actix-rt = { workspace = true } diff --git a/crates/server/src/actors/mod.rs b/crates/server/src/actors/mod.rs index 771b9fe..372682a 100644 --- a/crates/server/src/actors/mod.rs +++ b/crates/server/src/actors/mod.rs @@ -1,3 +1,2 @@ -pub mod file_watcher; pub mod messages; pub mod server; diff --git a/crates/server/src/actors/server.rs b/crates/server/src/actors/server.rs index 75bcb00..a55a941 100644 --- a/crates/server/src/actors/server.rs +++ b/crates/server/src/actors/server.rs @@ -1,17 +1,16 @@ // -use std::path::PathBuf; - -use crate::actors::file_watcher::FileUpdated; use actix::prelude::*; use config::server::{ServerConfig, ServerStorage, Webhook}; use config::{ForgeAlias, ForgeConfig, GitDir, RepoAlias, ServerRepoConfig}; use git::{repository::RepositoryFactory, Generation, RepoDetails}; use git_next_actor_macros::message; use git_next_config as config; +use git_next_file_watcher_actor::FileUpdated; use git_next_git as git; use git_next_repo_actor::{messages::CloneRepo, RepoActor}; use git_next_webhook_actor as webhook; use kxio::{fs::FileSystem, network::Network}; +use std::path::PathBuf; use tracing::{error, info, warn}; use webhook::{AddWebhookRecipient, ShutdownWebhook, WebhookActor, WebhookRouter}; diff --git a/crates/server/src/lib.rs b/crates/server/src/lib.rs index e4e6ea6..2c201c5 100644 --- a/crates/server/src/lib.rs +++ b/crates/server/src/lib.rs @@ -1,19 +1,14 @@ -mod actors; -mod config; // +use crate::actors::server::Server; use actix::prelude::*; - +use git_next_file_watcher_actor::{FileUpdated, FileWatcher}; use git_next_git::repository::RepositoryFactory; use kxio::{fs::FileSystem, network::Network}; - use std::path::PathBuf; - use tracing::{error, info, level_filters::LevelFilter}; -use crate::actors::{ - file_watcher::{self, FileUpdated}, - server::Server, -}; +mod actors; +mod config; pub fn init(fs: FileSystem) { let file_name = "git-next-server.toml"; @@ -50,8 +45,7 @@ pub async fn start( server.do_send(FileUpdated); info!("Starting File Watcher..."); - let fw = match file_watcher::FileWatcher::new("git-next-server.toml".into(), server.recipient()) - { + let fw = match FileWatcher::new("git-next-server.toml".into(), server.recipient()) { Ok(fw) => fw, Err(err) => { error!(?err, "Failed to start file watcher");