diff --git a/Cargo.toml b/Cargo.toml index 27ffa4c..bab52d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,47 +1,2 @@ -[package] -name = "horust" -version = "0.1.8" -authors = ["Federico Ponzi "] -description = "A complete supervisor and init system, designed for running in containers." -edition = "2021" -license = "MIT" -repository = "https://github.com/FedericoPonzi/horust" -homepage = "https://github.com/FedericoPonzi/horust" -readme = "README.md" -keywords = ["init", "container", "supervisor"] -categories = ["command-line-utilities"] -include = ["src/**/*", "Cargo.*", "LICENSE.txt", "README.md", "/example_services/**/*"] - -[dependencies] -clap = { version = "~4.5", features = ["derive"] } -crossbeam = "~0.8" -env_logger = "~0.11" -humantime-serde = "~1.1" -libc = "~0.2" -log = "~0.4" -nix = { version = "~0.29", features = ["process", "user", "signal", "fs"] } -reqwest = { version = "~0.12", features = ["blocking", "json"], optional = true, default-features = false } -serde = { version = "~1.0", features = ["derive"] } -shlex = "~1.3" -toml = "~0.8" -maplit = "~1.0" -shellexpand = "~3.1" -anyhow = "~1.0" -thiserror = "~1.0" -bytefmt = "0.1.7" - -[features] -default = ["http-healthcheck"] -http-healthcheck = ["reqwest"] - -[dev-dependencies] -assert_cmd = "~2.0" -predicates = "~3.1" -tempdir = "~0.3" -rand = "~0.8" - -[profile.release] -strip = "symbols" - [workspace] -members = ["horustctl", "commands"] +members = ["commands", "horust", "horustctl"] diff --git a/commands/src/lib.rs b/commands/src/lib.rs index 21cff63..beaaec1 100644 --- a/commands/src/lib.rs +++ b/commands/src/lib.rs @@ -1,7 +1,6 @@ mod proto; use anyhow::{bail, Context, Result}; -use proto::tutorial::*; use std::path::{Path, PathBuf}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{UnixListener, UnixStream}; diff --git a/commands/src/proto/mod.rs b/commands/src/proto/mod.rs index 0559c4b..8b13789 100644 --- a/commands/src/proto/mod.rs +++ b/commands/src/proto/mod.rs @@ -1 +1 @@ -pub mod tutorial; + diff --git a/commands/src/proto/tutorial.rs b/commands/src/proto/tutorial.rs index 7574859..d157a16 100644 --- a/commands/src/proto/tutorial.rs +++ b/commands/src/proto/tutorial.rs @@ -20,7 +20,17 @@ pub mod person { #[prost(enumeration = "PhoneType", tag = "2")] pub r#type: i32, } - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum PhoneType { Mobile = 0, diff --git a/horust/Cargo.toml b/horust/Cargo.toml new file mode 100644 index 0000000..564da28 --- /dev/null +++ b/horust/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "horust" +version = "0.1.8" +authors = ["Federico Ponzi "] +description = "A complete supervisor and init system, designed for running in containers." +edition = "2021" +license = "MIT" +repository = "https://github.com/FedericoPonzi/horust" +homepage = "https://github.com/FedericoPonzi/horust" +readme = "README.md" +keywords = ["init", "container", "supervisor"] +categories = ["command-line-utilities"] +include = ["src/**/*", "Cargo.*", "LICENSE.txt", "README.md", "/example_services/**/*"] + +[dependencies] +clap = { version = "~4.5", features = ["derive"] } +crossbeam = "~0.8" +env_logger = "~0.11" +humantime-serde = "~1.1" +libc = "~0.2" +log = "~0.4" +nix = { version = "~0.29", features = ["process", "user", "signal", "fs"] } +reqwest = { version = "~0.12", features = ["blocking", "json"], optional = true, default-features = false } +serde = { version = "~1.0", features = ["derive"] } +shlex = "~1.3" +toml = "~0.8" +maplit = "~1.0" +shellexpand = "~3.1" +anyhow = "~1.0" +thiserror = "~1.0" +bytefmt = "0.1.7" + +[features] +default = ["http-healthcheck"] +http-healthcheck = ["reqwest"] + +[dev-dependencies] +assert_cmd = "~2.0" +predicates = "~3.1" +tempdir = "~0.3" +rand = "~0.8" + +[profile.release] +strip = "symbols" diff --git a/src/horust/bus.rs b/horust/src/horust/bus.rs similarity index 100% rename from src/horust/bus.rs rename to horust/src/horust/bus.rs diff --git a/src/horust/error.rs b/horust/src/horust/error.rs similarity index 100% rename from src/horust/error.rs rename to horust/src/horust/error.rs diff --git a/src/horust/formats/horust_config.rs b/horust/src/horust/formats/horust_config.rs similarity index 100% rename from src/horust/formats/horust_config.rs rename to horust/src/horust/formats/horust_config.rs diff --git a/src/horust/formats/mod.rs b/horust/src/horust/formats/mod.rs similarity index 100% rename from src/horust/formats/mod.rs rename to horust/src/horust/formats/mod.rs diff --git a/src/horust/formats/service.rs b/horust/src/horust/formats/service.rs similarity index 99% rename from src/horust/formats/service.rs rename to horust/src/horust/formats/service.rs index e1d0028..91c6c5f 100644 --- a/src/horust/formats/service.rs +++ b/horust/src/horust/formats/service.rs @@ -14,7 +14,7 @@ use std::{env, os::fd::RawFd}; use crate::horust::error::{ValidationError, ValidationErrors}; pub fn get_sample_service() -> &'static str { - include_str!("../../../example_services/sample_service.toml") + include_str!("../../../../example_services/sample_service.toml") } pub type ServiceName = String; diff --git a/src/horust/healthcheck/checks.rs b/horust/src/horust/healthcheck/checks.rs similarity index 100% rename from src/horust/healthcheck/checks.rs rename to horust/src/horust/healthcheck/checks.rs diff --git a/src/horust/healthcheck/mod.rs b/horust/src/horust/healthcheck/mod.rs similarity index 100% rename from src/horust/healthcheck/mod.rs rename to horust/src/horust/healthcheck/mod.rs diff --git a/src/horust/mod.rs b/horust/src/horust/mod.rs similarity index 100% rename from src/horust/mod.rs rename to horust/src/horust/mod.rs diff --git a/src/horust/signal_safe.rs b/horust/src/horust/signal_safe.rs similarity index 100% rename from src/horust/signal_safe.rs rename to horust/src/horust/signal_safe.rs diff --git a/src/horust/supervisor/mod.rs b/horust/src/horust/supervisor/mod.rs similarity index 100% rename from src/horust/supervisor/mod.rs rename to horust/src/horust/supervisor/mod.rs diff --git a/src/horust/supervisor/process_spawner.rs b/horust/src/horust/supervisor/process_spawner.rs similarity index 100% rename from src/horust/supervisor/process_spawner.rs rename to horust/src/horust/supervisor/process_spawner.rs diff --git a/src/horust/supervisor/reaper.rs b/horust/src/horust/supervisor/reaper.rs similarity index 100% rename from src/horust/supervisor/reaper.rs rename to horust/src/horust/supervisor/reaper.rs diff --git a/src/horust/supervisor/repo.rs b/horust/src/horust/supervisor/repo.rs similarity index 100% rename from src/horust/supervisor/repo.rs rename to horust/src/horust/supervisor/repo.rs diff --git a/src/horust/supervisor/service_handler.rs b/horust/src/horust/supervisor/service_handler.rs similarity index 100% rename from src/horust/supervisor/service_handler.rs rename to horust/src/horust/supervisor/service_handler.rs diff --git a/src/horust/supervisor/signal_handling.rs b/horust/src/horust/supervisor/signal_handling.rs similarity index 100% rename from src/horust/supervisor/signal_handling.rs rename to horust/src/horust/supervisor/signal_handling.rs diff --git a/src/horust/uds_messages.rs b/horust/src/horust/uds_messages.rs similarity index 100% rename from src/horust/uds_messages.rs rename to horust/src/horust/uds_messages.rs diff --git a/src/lib.rs b/horust/src/lib.rs similarity index 100% rename from src/lib.rs rename to horust/src/lib.rs diff --git a/src/main.rs b/horust/src/main.rs similarity index 100% rename from src/main.rs rename to horust/src/main.rs diff --git a/tests/horust.rs b/horust/tests/horust.rs similarity index 100% rename from tests/horust.rs rename to horust/tests/horust.rs diff --git a/tests/section_environment.rs b/horust/tests/section_environment.rs similarity index 100% rename from tests/section_environment.rs rename to horust/tests/section_environment.rs diff --git a/tests/section_failure.rs b/horust/tests/section_failure.rs similarity index 100% rename from tests/section_failure.rs rename to horust/tests/section_failure.rs diff --git a/tests/section_general.rs b/horust/tests/section_general.rs similarity index 100% rename from tests/section_general.rs rename to horust/tests/section_general.rs diff --git a/tests/section_healthiness.rs b/horust/tests/section_healthiness.rs similarity index 100% rename from tests/section_healthiness.rs rename to horust/tests/section_healthiness.rs diff --git a/tests/section_restart.rs b/horust/tests/section_restart.rs similarity index 100% rename from tests/section_restart.rs rename to horust/tests/section_restart.rs diff --git a/tests/section_termination.rs b/horust/tests/section_termination.rs similarity index 100% rename from tests/section_termination.rs rename to horust/tests/section_termination.rs diff --git a/tests/service_deserialization.rs b/horust/tests/service_deserialization.rs similarity index 92% rename from tests/service_deserialization.rs rename to horust/tests/service_deserialization.rs index c8afad5..96e61cb 100644 --- a/tests/service_deserialization.rs +++ b/horust/tests/service_deserialization.rs @@ -23,7 +23,7 @@ mod tests { fn should_deserialize() { // TODO: this shouldn't be an integration test, but rather a unit test. let base = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let services_path = base.join("example_services"); + let services_path = base.join("../../example_services"); let services = list_files(&services_path).unwrap().len(); let horust = Horust::from_services_dirs(&[services_path]).unwrap(); assert_eq!(horust.get_services().len(), services); diff --git a/tests/utils/mod.rs b/horust/tests/utils/mod.rs similarity index 100% rename from tests/utils/mod.rs rename to horust/tests/utils/mod.rs