diff --git a/Cargo.toml b/Cargo.toml index e535c0b..286231b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,10 @@ [workspace] resolver = "2" -members = ["crates/cli"] +members = ["crates/cli", "crates/server"] + +[workspace.package] +version = "0.3.0" +edition = "2021" [workspace.lints.clippy] nursery = { level = "warn", priority = -1 } diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 6ad8779..103fb7b 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,14 +1,16 @@ [package] name = "git-next" -version = "0.3.0" -edition = "2021" +version = { workspace = true } +edition = { workspace = true } -[features] -default = ["forgejo"] -forgejo = [] -github = [] +# [features] +# default = ["forgejo"] +# forgejo = [] +# github = [] [dependencies] +git-next-server = { path = "../server" } + # CLI parsing clap = { workspace = true } diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 526d9d4..b16f13b 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -1,5 +1,4 @@ mod init; -mod server; use std::path::PathBuf; @@ -36,10 +35,10 @@ async fn main() { } Command::Server(server) => match server { Server::Init => { - server::init(fs); + git_next_server::init(fs); } Server::Start => { - server::start(fs, net).await; + git_next_server::start(fs, net).await; } }, } diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml new file mode 100644 index 0000000..3aeaf77 --- /dev/null +++ b/crates/server/Cargo.toml @@ -0,0 +1,73 @@ +[package] +name = "git-next-server" +version = { workspace = true } +edition = { workspace = true } + +[features] +default = ["forgejo"] +forgejo = [] +github = [] + +[dependencies] +# CLI parsing +clap = { workspace = true } + +# logging +console-subscriber = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } + +# base64 decoding +base64 = { workspace = true } + +# git +# gix = { workspace = true } +gix = { workspace = true } +async-trait = { workspace = true } + +# fs/network +kxio = { workspace = true } + +# fs +tempfile = { 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 } + +# error handling +derive_more = { workspace = true } +terrors = { workspace = true } + +# file watcher +inotify = { workspace = true } + +# Actors +actix = { workspace = true } +actix-rt = { workspace = true } +tokio = { workspace = true } + +[dev-dependencies] +# Testing +assert2 = { workspace = true } +pretty_assertions = { workspace = true } +test-log = { workspace = true } +anyhow = { workspace = true } + +[lints.clippy] +nursery = { level = "warn", priority = -1 } +# pedantic = "warn" +unwrap_used = "warn" +expect_used = "warn" diff --git a/crates/cli/src/server/actors/file_watcher.rs b/crates/server/src/actors/file_watcher.rs similarity index 100% rename from crates/cli/src/server/actors/file_watcher.rs rename to crates/server/src/actors/file_watcher.rs diff --git a/crates/cli/src/server/actors/mod.rs b/crates/server/src/actors/mod.rs similarity index 100% rename from crates/cli/src/server/actors/mod.rs rename to crates/server/src/actors/mod.rs diff --git a/crates/cli/src/server/actors/repo/branch.rs b/crates/server/src/actors/repo/branch.rs similarity index 99% rename from crates/cli/src/server/actors/repo/branch.rs rename to crates/server/src/actors/repo/branch.rs index 159e1a1..1f2e3f5 100644 --- a/crates/cli/src/server/actors/repo/branch.rs +++ b/crates/server/src/actors/repo/branch.rs @@ -4,7 +4,7 @@ use actix::prelude::*; use tracing::{info, warn}; -use crate::server::{ +use crate::{ actors::repo::{LoadConfigFromRepo, RepoActor, ValidateRepo}, config::{self, RepoConfigSource}, gitforge, diff --git a/crates/cli/src/server/actors/repo/config.rs b/crates/server/src/actors/repo/config.rs similarity index 94% rename from crates/cli/src/server/actors/repo/config.rs rename to crates/server/src/actors/repo/config.rs index c36c8b9..12cf70e 100644 --- a/crates/cli/src/server/actors/repo/config.rs +++ b/crates/server/src/actors/repo/config.rs @@ -1,7 +1,7 @@ use actix::prelude::*; use tracing::{error, info}; -use crate::server::{config, gitforge}; +use crate::{config, gitforge}; use super::{LoadedConfig, RepoActor}; diff --git a/crates/cli/src/server/actors/repo/mod.rs b/crates/server/src/actors/repo/mod.rs similarity index 98% rename from crates/cli/src/server/actors/repo/mod.rs rename to crates/server/src/actors/repo/mod.rs index 19101be..824756c 100644 --- a/crates/cli/src/server/actors/repo/mod.rs +++ b/crates/server/src/actors/repo/mod.rs @@ -7,7 +7,7 @@ use actix::prelude::*; use kxio::network::Network; use tracing::{debug, info, warn, Instrument}; -use crate::server::{ +use crate::{ actors::repo::webhook::WebhookAuth, config::{RepoConfig, RepoDetails, Webhook}, gitforge::{self, Repository}, @@ -39,11 +39,11 @@ impl RepoActor { ) -> Self { let forge = match details.forge.forge_type { #[cfg(feature = "forgejo")] - crate::server::config::ForgeType::ForgeJo => { + crate::config::ForgeType::ForgeJo => { gitforge::Forge::new_forgejo(details.clone(), net.clone()) } #[cfg(test)] - crate::server::config::ForgeType::MockForge => gitforge::Forge::new_mock(), + crate::config::ForgeType::MockForge => gitforge::Forge::new_mock(), }; debug!(?forge, "new"); Self { diff --git a/crates/cli/src/server/actors/repo/status.rs b/crates/server/src/actors/repo/status.rs similarity index 91% rename from crates/cli/src/server/actors/repo/status.rs rename to crates/server/src/actors/repo/status.rs index f0b76d9..9064bb2 100644 --- a/crates/cli/src/server/actors/repo/status.rs +++ b/crates/server/src/actors/repo/status.rs @@ -2,7 +2,7 @@ use actix::prelude::*; use gix::trace::warn; use tracing::info; -use crate::server::{actors::repo::ValidateRepo, gitforge, types::MessageToken}; +use crate::{actors::repo::ValidateRepo, gitforge, types::MessageToken}; use super::AdvanceMainTo; diff --git a/crates/cli/src/server/actors/repo/webhook.rs b/crates/server/src/actors/repo/webhook.rs similarity index 98% rename from crates/cli/src/server/actors/repo/webhook.rs rename to crates/server/src/actors/repo/webhook.rs index cc1787a..f23e2b2 100644 --- a/crates/cli/src/server/actors/repo/webhook.rs +++ b/crates/server/src/actors/repo/webhook.rs @@ -5,7 +5,7 @@ use ulid::DecodeError; use std::{collections::HashMap, fmt::Display, ops::Deref, str::FromStr}; -use crate::server::{ +use crate::{ actors::{ repo::{RepoActor, ValidateRepo, WebhookRegistered}, webhook::WebhookMessage, @@ -60,7 +60,7 @@ impl Deref for WebhookAuth { #[tracing::instrument(skip_all, fields(%webhook_id))] pub async fn unregister( webhook_id: WebhookId, - repo_details: crate::server::config::RepoDetails, + repo_details: crate::config::RepoDetails, net: network::Network, ) { let hostname = &repo_details.forge.hostname; @@ -88,7 +88,7 @@ pub async fn unregister( #[tracing::instrument(skip_all)] pub async fn register( - repo_details: crate::server::config::RepoDetails, + repo_details: crate::config::RepoDetails, webhook: Webhook, addr: actix::prelude::Addr, net: network::Network, @@ -147,7 +147,7 @@ pub async fn register( } async fn find_existing_webhooks( - repo_details: &crate::server::config::RepoDetails, + repo_details: &crate::config::RepoDetails, webhook_url: &WebhookUrl, net: &network::Network, ) -> Vec { diff --git a/crates/cli/src/server/actors/server.rs b/crates/server/src/actors/server.rs similarity index 99% rename from crates/cli/src/server/actors/server.rs rename to crates/server/src/actors/server.rs index becabfc..74789d3 100644 --- a/crates/cli/src/server/actors/server.rs +++ b/crates/server/src/actors/server.rs @@ -5,7 +5,7 @@ use actix::prelude::*; use kxio::{fs::FileSystem, network::Network}; use tracing::{error, info, warn}; -use crate::server::{ +use crate::{ actors::{ file_watcher::FileUpdated, repo::{CloneRepo, RepoActor}, @@ -28,7 +28,7 @@ pub enum Error { path: PathBuf, }, - Config(crate::server::config::Error), + Config(crate::config::Error), Io(std::io::Error), } diff --git a/crates/cli/src/server/actors/webhook/message.rs b/crates/server/src/actors/webhook/message.rs similarity index 95% rename from crates/cli/src/server/actors/webhook/message.rs rename to crates/server/src/actors/webhook/message.rs index ce89689..e719fe2 100644 --- a/crates/cli/src/server/actors/webhook/message.rs +++ b/crates/server/src/actors/webhook/message.rs @@ -1,7 +1,7 @@ // use actix::prelude::*; -use crate::server::actors::repo::webhook::WebhookAuth; +use crate::actors::repo::webhook::WebhookAuth; #[derive(Message, Debug, Clone)] #[rtype(result = "()")] diff --git a/crates/cli/src/server/actors/webhook/mod.rs b/crates/server/src/actors/webhook/mod.rs similarity index 100% rename from crates/cli/src/server/actors/webhook/mod.rs rename to crates/server/src/actors/webhook/mod.rs diff --git a/crates/cli/src/server/actors/webhook/router.rs b/crates/server/src/actors/webhook/router.rs similarity index 94% rename from crates/cli/src/server/actors/webhook/router.rs rename to crates/server/src/actors/webhook/router.rs index 79fb65f..1e4ede5 100644 --- a/crates/cli/src/server/actors/webhook/router.rs +++ b/crates/server/src/actors/webhook/router.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use actix::prelude::*; use tracing::{debug, info}; -use crate::server::{actors::webhook::message::WebhookMessage, config::RepoAlias}; +use crate::{actors::webhook::message::WebhookMessage, config::RepoAlias}; pub struct WebhookRouter { span: tracing::Span, diff --git a/crates/cli/src/server/actors/webhook/server.rs b/crates/server/src/actors/webhook/server.rs similarity index 97% rename from crates/cli/src/server/actors/webhook/server.rs rename to crates/server/src/actors/webhook/server.rs index 90cc07c..d3b53c7 100644 --- a/crates/cli/src/server/actors/webhook/server.rs +++ b/crates/server/src/actors/webhook/server.rs @@ -4,7 +4,7 @@ use actix::prelude::*; use tracing::{debug, info}; -use crate::server::actors::webhook::message::WebhookMessage; +use crate::actors::webhook::message::WebhookMessage; pub async fn start( socket_addr: SocketAddr, diff --git a/crates/cli/src/server/config/load.rs b/crates/server/src/config/load.rs similarity index 96% rename from crates/cli/src/server/config/load.rs rename to crates/server/src/config/load.rs index e201bb3..7a59799 100644 --- a/crates/cli/src/server/config/load.rs +++ b/crates/server/src/config/load.rs @@ -1,7 +1,7 @@ use terrors::OneOf; use tracing::error; -use crate::server::{ +use crate::{ config::{BranchName, RepoConfig, RepoDetails}, gitforge::{self, ForgeFileError}, }; @@ -13,7 +13,7 @@ pub async fn load( RepoConfig, OneOf<( ForgeFileError, - crate::server::config::Error, + crate::config::Error, toml::de::Error, RepoConfigValidationErrors, )>, diff --git a/crates/cli/src/server/config/mod.rs b/crates/server/src/config/mod.rs similarity index 99% rename from crates/cli/src/server/config/mod.rs rename to crates/server/src/config/mod.rs index 7b11eac..c1d0cc7 100644 --- a/crates/cli/src/server/config/mod.rs +++ b/crates/server/src/config/mod.rs @@ -16,7 +16,7 @@ use serde::Deserialize; use kxio::fs::FileSystem; use tracing::info; -use crate::server::{gitforge::Repository, types::ServerGeneration}; +use crate::{gitforge::Repository, types::ServerGeneration}; #[derive(Debug, derive_more::From, derive_more::Display)] pub enum Error { diff --git a/crates/cli/src/server/config/tests.rs b/crates/server/src/config/tests.rs similarity index 98% rename from crates/cli/src/server/config/tests.rs rename to crates/server/src/config/tests.rs index 4dbe9ca..f048962 100644 --- a/crates/cli/src/server/config/tests.rs +++ b/crates/server/src/config/tests.rs @@ -2,7 +2,7 @@ use assert2::let_assert; use gix::remote::Direction; use pretty_assertions::assert_eq; -use crate::{server::gitforge::tests::common /* server::gitforge::tests::common */}; +use crate::{gitforge::tests::common /* server::gitforge::tests::common */}; use kxio::fs; diff --git a/crates/cli/src/server/git/mod.rs b/crates/server/src/git/mod.rs similarity index 100% rename from crates/cli/src/server/git/mod.rs rename to crates/server/src/git/mod.rs diff --git a/crates/cli/src/server/git/reset.rs b/crates/server/src/git/reset.rs similarity index 98% rename from crates/cli/src/server/git/reset.rs rename to crates/server/src/git/reset.rs index 3a46bab..01dd4cd 100644 --- a/crates/cli/src/server/git/reset.rs +++ b/crates/server/src/git/reset.rs @@ -3,7 +3,7 @@ use std::ops::Deref; use secrecy::ExposeSecret; use tracing::{info, warn}; -use crate::server::{ +use crate::{ config::{BranchName, RepoDetails}, gitforge::{BranchResetError, BranchResetResult, Force, Repository}, types::GitRef, diff --git a/crates/cli/src/server/gitforge/errors.rs b/crates/server/src/gitforge/errors.rs similarity index 98% rename from crates/cli/src/server/gitforge/errors.rs rename to crates/server/src/gitforge/errors.rs index 3eadea0..0b11348 100644 --- a/crates/cli/src/server/gitforge/errors.rs +++ b/crates/server/src/gitforge/errors.rs @@ -1,4 +1,4 @@ -use crate::server::config::{BranchName, GitDir}; +use crate::config::{BranchName, GitDir}; #[derive(Debug)] pub enum ForgeFileError { diff --git a/crates/cli/src/server/gitforge/forgejo/branch/fetch.rs b/crates/server/src/gitforge/forgejo/branch/fetch.rs similarity index 94% rename from crates/cli/src/server/gitforge/forgejo/branch/fetch.rs rename to crates/server/src/gitforge/forgejo/branch/fetch.rs index 0124920..a901058 100644 --- a/crates/cli/src/server/gitforge/forgejo/branch/fetch.rs +++ b/crates/server/src/gitforge/forgejo/branch/fetch.rs @@ -2,7 +2,7 @@ use std::ops::Deref; use tracing::{debug, info}; -use crate::server::{config::RepoDetails, gitforge::Repository}; +use crate::{config::RepoDetails, gitforge::Repository}; #[derive(Debug, derive_more::From, derive_more::Display)] pub enum Error { diff --git a/crates/cli/src/server/gitforge/forgejo/branch/get_all.rs b/crates/server/src/gitforge/forgejo/branch/get_all.rs similarity index 98% rename from crates/cli/src/server/gitforge/forgejo/branch/get_all.rs rename to crates/server/src/gitforge/forgejo/branch/get_all.rs index 1a9cae1..87445d3 100644 --- a/crates/cli/src/server/gitforge/forgejo/branch/get_all.rs +++ b/crates/server/src/gitforge/forgejo/branch/get_all.rs @@ -1,7 +1,7 @@ use kxio::network::{self, Network}; use tracing::error; -use crate::server::{ +use crate::{ config::{BranchName, RepoDetails}, gitforge::{self, ForgeBranchError}, }; diff --git a/crates/cli/src/server/gitforge/forgejo/branch/mod.rs b/crates/server/src/gitforge/forgejo/branch/mod.rs similarity index 100% rename from crates/cli/src/server/gitforge/forgejo/branch/mod.rs rename to crates/server/src/gitforge/forgejo/branch/mod.rs diff --git a/crates/cli/src/server/gitforge/forgejo/branch/validate_positions.rs b/crates/server/src/gitforge/forgejo/branch/validate_positions.rs similarity index 99% rename from crates/cli/src/server/gitforge/forgejo/branch/validate_positions.rs rename to crates/server/src/gitforge/forgejo/branch/validate_positions.rs index d9e4647..2f42c57 100644 --- a/crates/cli/src/server/gitforge/forgejo/branch/validate_positions.rs +++ b/crates/server/src/gitforge/forgejo/branch/validate_positions.rs @@ -1,8 +1,7 @@ use kxio::network; use tracing::{debug, error, info, warn}; -use crate::server::{ - self, +use crate::{ config::{BranchName, RepoConfig, RepoDetails}, gitforge::{self, ForgeLike}, }; @@ -187,7 +186,7 @@ async fn get_commit_histories( #[tracing::instrument(fields(%branch_name),skip_all)] async fn get_commit_history( - repo_details: &server::config::RepoDetails, + repo_details: &crate::config::RepoDetails, branch_name: &BranchName, find_commits: Vec, net: &kxio::network::Network, diff --git a/crates/cli/src/server/gitforge/forgejo/file/mod.rs b/crates/server/src/gitforge/forgejo/file/mod.rs similarity index 99% rename from crates/cli/src/server/gitforge/forgejo/file/mod.rs rename to crates/server/src/gitforge/forgejo/file/mod.rs index 7d27b6d..dbf38c0 100644 --- a/crates/cli/src/server/gitforge/forgejo/file/mod.rs +++ b/crates/server/src/gitforge/forgejo/file/mod.rs @@ -1,7 +1,7 @@ use kxio::network::{self, Network}; use tracing::{error, warn}; -use crate::server::{ +use crate::{ config::{BranchName, RepoDetails}, gitforge::ForgeFileError, }; diff --git a/crates/cli/src/server/gitforge/forgejo/mod.rs b/crates/server/src/gitforge/forgejo/mod.rs similarity index 99% rename from crates/cli/src/server/gitforge/forgejo/mod.rs rename to crates/server/src/gitforge/forgejo/mod.rs index 66ada1f..4f9535d 100644 --- a/crates/cli/src/server/gitforge/forgejo/mod.rs +++ b/crates/server/src/gitforge/forgejo/mod.rs @@ -8,7 +8,7 @@ use actix::prelude::*; use kxio::network::{self, Network}; use tracing::{error, info, warn}; -use crate::server::{ +use crate::{ actors::repo::{RepoActor, StartMonitoring, ValidateRepo}, config::{BranchName, GitDir, RepoConfig, RepoDetails}, git, diff --git a/crates/cli/src/server/gitforge/github.rs b/crates/server/src/gitforge/github.rs similarity index 100% rename from crates/cli/src/server/gitforge/github.rs rename to crates/server/src/gitforge/github.rs diff --git a/crates/cli/src/server/gitforge/mock_forge.rs b/crates/server/src/gitforge/mock_forge.rs similarity index 98% rename from crates/cli/src/server/gitforge/mock_forge.rs rename to crates/server/src/gitforge/mock_forge.rs index f51c899..3803a55 100644 --- a/crates/cli/src/server/gitforge/mock_forge.rs +++ b/crates/server/src/gitforge/mock_forge.rs @@ -1,4 +1,4 @@ -use crate::server::{ +use crate::{ actors::repo::RepoActor, config::{BranchName, GitDir, RepoConfig}, gitforge::{self, RepoCloneError, Repository}, diff --git a/crates/cli/src/server/gitforge/mod.rs b/crates/server/src/gitforge/mod.rs similarity index 99% rename from crates/cli/src/server/gitforge/mod.rs rename to crates/server/src/gitforge/mod.rs index 0d57b62..9302877 100644 --- a/crates/cli/src/server/gitforge/mod.rs +++ b/crates/server/src/gitforge/mod.rs @@ -16,7 +16,7 @@ pub use types::*; mod errors; pub use errors::*; -use crate::server::{ +use crate::{ config::{BranchName, GitDir, RepoConfig, RepoDetails}, types::{GitRef, MessageToken}, }; diff --git a/crates/cli/src/server/gitforge/tests/common.rs b/crates/server/src/gitforge/tests/common.rs similarity index 98% rename from crates/cli/src/server/gitforge/tests/common.rs rename to crates/server/src/gitforge/tests/common.rs index 238108e..b456892 100644 --- a/crates/cli/src/server/gitforge/tests/common.rs +++ b/crates/server/src/gitforge/tests/common.rs @@ -1,4 +1,4 @@ -use crate::server::{ +use crate::{ config::{ ApiToken, BranchName, ForgeDetails, ForgeName, ForgeType, GitDir, Hostname, RepoAlias, RepoBranches, RepoConfig, RepoConfigSource, RepoDetails, RepoPath, User, diff --git a/crates/cli/src/server/gitforge/tests/data-forgejo-branches-get.json b/crates/server/src/gitforge/tests/data-forgejo-branches-get.json similarity index 100% rename from crates/cli/src/server/gitforge/tests/data-forgejo-branches-get.json rename to crates/server/src/gitforge/tests/data-forgejo-branches-get.json diff --git a/crates/cli/src/server/gitforge/tests/forgejo.rs b/crates/server/src/gitforge/tests/forgejo.rs similarity index 98% rename from crates/cli/src/server/gitforge/tests/forgejo.rs rename to crates/server/src/gitforge/tests/forgejo.rs index 67fa5e8..232dbfe 100644 --- a/crates/cli/src/server/gitforge/tests/forgejo.rs +++ b/crates/server/src/gitforge/tests/forgejo.rs @@ -2,7 +2,7 @@ use assert2::let_assert; use kxio::network::{MockNetwork, StatusCode}; -use crate::server::{ +use crate::{ config::{BranchName, ForgeType, RepoConfigSource}, types::ServerGeneration, }; diff --git a/crates/cli/src/server/gitforge/tests/github.rs b/crates/server/src/gitforge/tests/github.rs similarity index 100% rename from crates/cli/src/server/gitforge/tests/github.rs rename to crates/server/src/gitforge/tests/github.rs diff --git a/crates/cli/src/server/gitforge/tests/mod.rs b/crates/server/src/gitforge/tests/mod.rs similarity index 100% rename from crates/cli/src/server/gitforge/tests/mod.rs rename to crates/server/src/gitforge/tests/mod.rs diff --git a/crates/cli/src/server/gitforge/types.rs b/crates/server/src/gitforge/types.rs similarity index 95% rename from crates/cli/src/server/gitforge/types.rs rename to crates/server/src/gitforge/types.rs index 0b91e53..cc1edf6 100644 --- a/crates/cli/src/server/gitforge/types.rs +++ b/crates/server/src/gitforge/types.rs @@ -1,6 +1,6 @@ use std::{ops::Deref as _, path::PathBuf, sync::atomic::AtomicBool}; -use crate::server::{ +use crate::{ config::{BranchName, RepoDetails}, gitforge::RepoCloneError, }; @@ -16,7 +16,7 @@ impl Branch { #[derive(Debug)] pub enum Force { No, - From(crate::server::types::GitRef), + From(crate::types::GitRef), } impl std::fmt::Display for Force { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -30,7 +30,7 @@ impl std::fmt::Display for Force { #[derive(Debug, derive_more::From, derive_more::Display)] pub enum BranchResetError { Open(Box), - Fetch(crate::server::gitforge::forgejo::branch::fetch::Error), + Fetch(crate::gitforge::forgejo::branch::fetch::Error), Push, } impl std::error::Error for BranchResetError {} diff --git a/crates/cli/src/server/mod.rs b/crates/server/src/lib.rs similarity index 88% rename from crates/cli/src/server/mod.rs rename to crates/server/src/lib.rs index f829a20..9679666 100644 --- a/crates/cli/src/server/mod.rs +++ b/crates/server/src/lib.rs @@ -6,18 +6,15 @@ pub mod types; use actix::prelude::*; -use kxio::network::Network; +use kxio::{fs::FileSystem, network::Network}; use std::path::PathBuf; use tracing::{error, info, level_filters::LevelFilter}; -use crate::{ - fs::FileSystem, - server::actors::{ - file_watcher::{self, FileUpdated}, - server::Server, - }, +use crate::actors::{ + file_watcher::{self, FileUpdated}, + server::Server, }; pub fn init(fs: FileSystem) { @@ -33,7 +30,7 @@ pub fn init(fs: FileSystem) { file_name ); } else { - match fs.file_write(&pathbuf, include_str!("../../../../server-default.toml")) { + match fs.file_write(&pathbuf, include_str!("../../../server-default.toml")) { Ok(_) => println!("Created a default configuration file at {}", file_name), Err(e) => { eprintln!("Failed to write to the configuration file: {}", e) diff --git a/crates/cli/src/server/types.rs b/crates/server/src/types.rs similarity index 96% rename from crates/cli/src/server/types.rs rename to crates/server/src/types.rs index 681e267..fa4a4e3 100644 --- a/crates/cli/src/server/types.rs +++ b/crates/server/src/types.rs @@ -1,6 +1,6 @@ use std::fmt::Display; -use crate::server::{config::BranchName, gitforge}; +use crate::{config::BranchName, gitforge}; #[derive(Clone, Debug, Hash, PartialEq, Eq)] pub struct GitRef(pub String);