From ab4d2bf7c3fb47832ba4139875490dc1c4963bdf Mon Sep 17 00:00:00 2001 From: quirinecker Date: Tue, 7 Mar 2023 15:56:21 +0100 Subject: [PATCH 01/21] registered command for developement serving --- Cargo.lock | 2 +- src/app/commands/mod.rs | 4 +++- src/app/commands/serve.rs | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/app/commands/serve.rs diff --git a/Cargo.lock b/Cargo.lock index 2c50c96..c8b34df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -135,7 +135,7 @@ dependencies = [ [[package]] name = "docki" -version = "0.2.0" +version = "0.3.0" dependencies = [ "bytes", "colored", diff --git a/src/app/commands/mod.rs b/src/app/commands/mod.rs index fc7951d..602741a 100644 --- a/src/app/commands/mod.rs +++ b/src/app/commands/mod.rs @@ -2,13 +2,14 @@ use std::collections::HashMap; use traits::Command; -use self::{build::Build, health::Health, reveal::Reveal}; +use self::{build::Build, health::Health, reveal::Reveal, serve::Serve}; pub mod traits; pub mod executions; mod build; mod health; mod reveal; +mod serve; pub struct CommandRegistry { commands: HashMap> @@ -21,6 +22,7 @@ impl CommandRegistry { registry.register("/build".to_string(), Box::new(Build::new()), true); registry.register("/health".to_string(), Box::new(Health::new()), true); registry.register("/install-reveal".to_string(), Box::new(Reveal::new()), true); + registry.register("/serve".to_string(), Box::new(Serve::new()), true) } diff --git a/src/app/commands/serve.rs b/src/app/commands/serve.rs new file mode 100644 index 0000000..ca0fb3b --- /dev/null +++ b/src/app/commands/serve.rs @@ -0,0 +1,14 @@ +use super::traits::Command; + +pub struct Serve; + +impl Command for Serve { + fn execute(&self, _args: &std::collections::HashMap) -> Result<(), String> { + println!("serving the application"); + return Ok(()) + } + + fn new() -> Self where Self: Sized { + return Self {} + } +} From 85218ba57fd311a2c8017091f393ad0ebfa052ed Mon Sep 17 00:00:00 2001 From: QuirinEcker Date: Wed, 8 Mar 2023 20:39:57 +0100 Subject: [PATCH 02/21] added argument parsing and structure with clap --- Cargo.lock | 203 +++++++++++++++++++++++++++++++++++++- Cargo.toml | 1 + src/app/args/mod.rs | 10 ++ src/app/args/structure.rs | 12 +++ src/app/mod.rs | 8 +- 5 files changed, 229 insertions(+), 5 deletions(-) create mode 100644 src/app/args/mod.rs create mode 100644 src/app/args/structure.rs diff --git a/Cargo.lock b/Cargo.lock index c8b34df..b0bdb4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,6 +97,43 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "clap" +version = "4.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5" +dependencies = [ + "bitflags", + "clap_derive", + "clap_lex", + "is-terminal", + "once_cell", + "strsim", + "termcolor", +] + +[[package]] +name = "clap_derive" +version = "4.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bec8e5c9d09e439c4335b1af0abaab56dcf3b94999a936e1bb47b9134288f0" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "colored" version = "2.0.0" @@ -138,6 +175,7 @@ name = "docki" version = "0.3.0" dependencies = [ "bytes", + "clap", "colored", "home", "regex", @@ -155,6 +193,27 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fastrand" version = "1.8.0" @@ -277,6 +336,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -295,6 +360,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "home" version = "0.5.4" @@ -404,12 +475,34 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" +dependencies = [ + "libc", + "windows-sys 0.45.0", +] + [[package]] name = "ipnet" version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" +[[package]] +name = "is-terminal" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +dependencies = [ + "hermit-abi 0.3.1", + "io-lifetimes", + "rustix", + "windows-sys 0.45.0", +] + [[package]] name = "itoa" version = "1.0.5" @@ -437,6 +530,12 @@ version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + [[package]] name = "log" version = "0.4.17" @@ -476,7 +575,7 @@ dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -558,6 +657,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "os_str_bytes" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" + [[package]] name = "percent-encoding" version = "2.2.0" @@ -582,6 +687,30 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.50" @@ -672,6 +801,20 @@ dependencies = [ "winreg", ] +[[package]] +name = "rustix" +version = "0.36.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.45.0", +] + [[package]] name = "ryu" version = "1.0.12" @@ -684,7 +827,7 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -758,6 +901,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "syn" version = "1.0.107" @@ -783,6 +932,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "text_io" version = "0.1.12" @@ -849,7 +1007,7 @@ dependencies = [ "num_cpus", "pin-project-lite", "socket2", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -946,6 +1104,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + [[package]] name = "want" version = "0.3.0" @@ -1060,6 +1224,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1081,6 +1254,30 @@ dependencies = [ "windows_x86_64_msvc", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.1" diff --git a/Cargo.toml b/Cargo.toml index 2fe412d..cda3610 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ license-file = "LICENSE.txt" [dependencies] bytes = "1.4.0" +clap = { version = "4.1.8", features = ["derive"] } colored = "2.0.0" home = "0.5.4" regex = "1.7.1" diff --git a/src/app/args/mod.rs b/src/app/args/mod.rs new file mode 100644 index 0000000..ab1e51b --- /dev/null +++ b/src/app/args/mod.rs @@ -0,0 +1,10 @@ +use clap::Parser; + +use self::structure::Args; + +mod structure; + +pub fn args() -> Args { + return Args::parse(); + +} diff --git a/src/app/args/structure.rs b/src/app/args/structure.rs new file mode 100644 index 0000000..742483c --- /dev/null +++ b/src/app/args/structure.rs @@ -0,0 +1,12 @@ +use clap::{Parser, Subcommand}; + +#[derive(Parser)] +pub struct Args { + #[command(subcommand)] + command: Option +} + +#[derive(Subcommand)] +enum CommandArg { + Build, +} diff --git a/src/app/mod.rs b/src/app/mod.rs index ff73392..a0216ba 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,6 +1,7 @@ mod commands; pub mod builder; pub mod fs_util; +mod args; use std::collections::HashMap; use std::env; @@ -8,6 +9,8 @@ use std::env; use commands::traits::Command; use commands::CommandRegistry; +use self::args::args; + pub struct App { command_regisrty: CommandRegistry, } @@ -19,9 +22,10 @@ impl App { } } - pub fn start(self, args: Vec) { + pub fn start(self, old_args: Vec) { + let args = args(); Self::preapare_env_path(); - let command_args = &args[1..]; + let command_args = &old_args[1..]; let mut path = String::from(""); let mut argument_map = HashMap::new(); let mut only_options_left = false; From e469576d2c3a995beeaff32f455832227aa62db8 Mon Sep 17 00:00:00 2001 From: QuirinEcker Date: Wed, 8 Mar 2023 20:43:36 +0100 Subject: [PATCH 03/21] made some changes to the structure --- src/app/args/structure.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/args/structure.rs b/src/app/args/structure.rs index 742483c..4f5f53f 100644 --- a/src/app/args/structure.rs +++ b/src/app/args/structure.rs @@ -3,10 +3,12 @@ use clap::{Parser, Subcommand}; #[derive(Parser)] pub struct Args { #[command(subcommand)] - command: Option + command: CommandArg } #[derive(Subcommand)] enum CommandArg { Build, + Health, + InstallReveal } From 4b789e60c92f70a200642df69f0493a7b51776a2 Mon Sep 17 00:00:00 2001 From: QuirinEcker Date: Wed, 8 Mar 2023 21:35:15 +0100 Subject: [PATCH 04/21] refactored the project using the clap crate --- src/app/args/mod.rs | 2 +- src/app/args/structure.rs | 4 +- src/app/commands/build.rs | 21 ++---- src/app/commands/health.rs | 104 ++++++++++++----------------- src/app/commands/install_reveal.rs | 26 ++++++++ src/app/commands/mod.rs | 48 +------------ src/app/commands/reveal.rs | 43 ------------ src/app/mod.rs | 70 ++++--------------- src/main.rs | 5 +- src/test/fs_util.rs | 2 - 10 files changed, 92 insertions(+), 233 deletions(-) create mode 100644 src/app/commands/install_reveal.rs delete mode 100644 src/app/commands/reveal.rs diff --git a/src/app/args/mod.rs b/src/app/args/mod.rs index ab1e51b..f90c1d9 100644 --- a/src/app/args/mod.rs +++ b/src/app/args/mod.rs @@ -2,7 +2,7 @@ use clap::Parser; use self::structure::Args; -mod structure; +pub mod structure; pub fn args() -> Args { return Args::parse(); diff --git a/src/app/args/structure.rs b/src/app/args/structure.rs index 4f5f53f..f048ecc 100644 --- a/src/app/args/structure.rs +++ b/src/app/args/structure.rs @@ -3,11 +3,11 @@ use clap::{Parser, Subcommand}; #[derive(Parser)] pub struct Args { #[command(subcommand)] - command: CommandArg + pub command: CommandArg } #[derive(Subcommand)] -enum CommandArg { +pub enum CommandArg { Build, Health, InstallReveal diff --git a/src/app/commands/build.rs b/src/app/commands/build.rs index f1515d9..2e9161d 100644 --- a/src/app/commands/build.rs +++ b/src/app/commands/build.rs @@ -1,19 +1,6 @@ -use std::collections::HashMap; +use super::executions::build_execution::BuildExecution; -use super::{executions::build_execution::BuildExecution, traits::Command}; - -pub struct Build; - -impl Command for Build { - fn execute(&self, _args: &HashMap) -> Result<(), String> { - let mut build_execution = BuildExecution::new(); - return build_execution.execute(); - } - - fn new() -> Self - where - Self: Sized, - { - return Build {} - } +pub fn build() -> () { + let mut build_execution = BuildExecution::new(); + build_execution.execute().expect("build failed") } diff --git a/src/app/commands/health.rs b/src/app/commands/health.rs index 4cbca6c..ab5706e 100644 --- a/src/app/commands/health.rs +++ b/src/app/commands/health.rs @@ -1,11 +1,6 @@ -use std::{collections::HashMap, process, io::ErrorKind}; - +use std::{process::Command, io::ErrorKind}; use colored::Colorize; -use super::traits::Command; - -pub struct Health; - const INFO_ASCIIDOC: &str = " Install the binary with your package manager! @@ -28,64 +23,49 @@ Option 2: - Make sure the binary is called asciidoctor-revealjs and not asciidoctor-revealjs-linux or similar "; -impl Command for Health { - fn execute(&self, _args: &HashMap) -> Result<(), String> { - Self::health(); - return Ok(()) - } - - fn new() -> Self where Self: Sized { - return Self {} - } +pub fn health() { + check_asciidoc(); + check_reveal(); } - -impl Health { - fn health() { - Self::check_asciidoc(); - Self::check_reveal(); +fn check_reveal() -> () { + if reveal_is_installed() { + print_health_ok("asciidoctor-revealjs") + } else { + print_health_not_ok("asciidoctor-revealjs", INFO_REVEAL) } - - fn check_reveal() -> () { - if Self::reveal_is_installed() { - Self::print_health_ok("asciidoctor-revealjs") - } else { - Self::print_health_not_ok("asciidoctor-revealjs", INFO_REVEAL) - } - } - - fn reveal_is_installed() -> bool { - return Self::check_command("asciidoctor-revealjs") - } - - fn check_asciidoc() -> () { - if Self::asciidoc_is_installed() { - Self::print_health_ok("asciidoctor") - } else { - Self::print_health_not_ok("asciidoctor", INFO_ASCIIDOC) - } - } - - fn asciidoc_is_installed() -> bool { - return Self::check_command("asciidoctor") - } - - fn check_command(command: &str) -> bool { - return match process::Command::new(command) - .output() { - Ok(_) => true, - Err(e) => ErrorKind::NotFound != e.kind() - } - } - - fn print_health_ok(name: &str) { - println!("- ✔️ {}", name.bright_green()); - } - - fn print_health_not_ok(name: &str, info: &str) { - println!("- ❗{}", name.bright_red()); - println!("{}", info.bright_black()) - } - +} + +fn reveal_is_installed() -> bool { + return check_command("asciidoctor-revealjs") +} + +fn check_asciidoc() -> () { + if asciidoc_is_installed() { + print_health_ok("asciidoctor") + } else { + print_health_not_ok("asciidoctor", INFO_ASCIIDOC) + } +} + +fn asciidoc_is_installed() -> bool { + return check_command("asciidoctor") +} + +fn check_command(command: &str) -> bool { + return match Command::new(command) + .output() { + Ok(_) => true, + Err(e) => ErrorKind::NotFound != e.kind() + } +} + +fn print_health_ok(name: &str) { + println!("- ✔️ {}", name.bright_green()); +} + +fn print_health_not_ok(name: &str, info: &str) { + println!("- ❗{}", name.bright_red()); + println!("{}", info.bright_black()) } diff --git a/src/app/commands/install_reveal.rs b/src/app/commands/install_reveal.rs new file mode 100644 index 0000000..de38a0f --- /dev/null +++ b/src/app/commands/install_reveal.rs @@ -0,0 +1,26 @@ +use std::{fs::File, io::Write}; + +use crate::app::fs_util; + +const ASCIIDOC_REVEAL_VERSION: &str= "v4.1.0-rc.5"; + +pub fn install_reveal() -> () { + let result = reqwest::blocking::get(url()) + .expect("Could not download reveal. Make sure you are connected to the internet"); + + let binary = result.bytes().expect("could not get binary"); + + let home_path = home::home_dir().expect("could not find home dir"); + let save_path = format!("{}/.docki/asciidoctor-revealjs", home_path.display()); + let save_dir = format!("{}/.docki", home_path.display()); + + fs_util::create_dir_recursive(save_dir.as_str()); + + let mut file = File::create(save_path).expect("could not save binary"); + file.write_all(&binary).expect("could not save binary"); +} + +fn url() -> String { + return format!("https://github.com/asciidoctor/asciidoctor-reveal.js/releases/download/{}/asciidoctor-revealjs-linux", ASCIIDOC_REVEAL_VERSION); +} + diff --git a/src/app/commands/mod.rs b/src/app/commands/mod.rs index 602741a..cbf575e 100644 --- a/src/app/commands/mod.rs +++ b/src/app/commands/mod.rs @@ -1,48 +1,6 @@ -use std::collections::HashMap; - -use traits::Command; - -use self::{build::Build, health::Health, reveal::Reveal, serve::Serve}; - pub mod traits; pub mod executions; -mod build; -mod health; -mod reveal; +pub mod build; +pub mod health; +pub mod install_reveal; mod serve; - -pub struct CommandRegistry { - commands: HashMap> -} - -impl CommandRegistry { - - pub fn register_all(&mut self) { - let registry = self; - registry.register("/build".to_string(), Box::new(Build::new()), true); - registry.register("/health".to_string(), Box::new(Health::new()), true); - registry.register("/install-reveal".to_string(), Box::new(Reveal::new()), true); - registry.register("/serve".to_string(), Box::new(Serve::new()), true) - - } - - pub fn register(&mut self, path: String, command: Box, enabled: bool) { - if enabled { - self.commands.insert(path, command); - } - } - - pub fn new() -> CommandRegistry { - let mut registry = CommandRegistry { commands: HashMap::new() }; - - registry.register_all(); - - registry - } - - pub fn command_by(&self, path: &String) -> Option<&Box> { - let command = self.commands.get(path); - return command; - } -} - diff --git a/src/app/commands/reveal.rs b/src/app/commands/reveal.rs deleted file mode 100644 index 21ea9d3..0000000 --- a/src/app/commands/reveal.rs +++ /dev/null @@ -1,43 +0,0 @@ -use std::{fs::File, io::Write}; - -use crate::app::fs_util; - -use super::traits::Command; - -pub struct Reveal; - -const ASCIIDOC_REVEAL_VERSION: &str= "v4.1.0-rc.5"; - -fn url() -> String { - return format!("https://github.com/asciidoctor/asciidoctor-reveal.js/releases/download/{}/asciidoctor-revealjs-linux", ASCIIDOC_REVEAL_VERSION); -} - -impl Command for Reveal { - fn execute(&self, _args: &std::collections::HashMap) -> Result<(), String> { - Self::install_asciidocto_revealjs(); - return Ok(()) - } - - fn new() -> Self where Self: Sized { - return Self {} - } -} - -impl Reveal { - fn install_asciidocto_revealjs() -> () { - let result = reqwest::blocking::get(url()) - .expect("Could not download reveal. Make sure you are connected to the internet"); - - let binary = result.bytes().expect("could not get binary"); - - let home_path = home::home_dir().expect("could not find home dir"); - let save_path = format!("{}/.docki/asciidoctor-revealjs", home_path.display()); - let save_dir = format!("{}/.docki", home_path.display()); - - fs_util::create_dir_recursive(save_dir.as_str()); - - let mut file = File::create(save_path).expect("could not save binary"); - file.write_all(&binary).expect("could not save binary"); - } - -} diff --git a/src/app/mod.rs b/src/app/mod.rs index a0216ba..8dfa61c 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -3,76 +3,32 @@ pub mod builder; pub mod fs_util; mod args; -use std::collections::HashMap; use std::env; -use commands::traits::Command; -use commands::CommandRegistry; +use self::args::{args, structure::CommandArg}; +use self::commands::build::build; +use self::commands::health::health; +use self::commands::install_reveal::install_reveal; -use self::args::args; - -pub struct App { - command_regisrty: CommandRegistry, -} +pub struct App; impl App { - pub fn new() -> App { - return App { - command_regisrty: CommandRegistry::new() - } - } - pub fn start(self, old_args: Vec) { + pub fn start(&self) { let args = args(); - Self::preapare_env_path(); - let command_args = &old_args[1..]; - let mut path = String::from(""); - let mut argument_map = HashMap::new(); - let mut only_options_left = false; - - for (index, argument) in command_args.iter().enumerate() { - if argument.starts_with("--") { - only_options_left = true; - let value = command_args.get(index + 1); - if let Some(v) = value { - if v.starts_with("--") { - argument_map.insert(argument.replace("--", ""), String::from("")); - } else { - argument_map.insert(argument.replace("--", ""), String::from(v)); - } - } else { - argument_map.insert(argument.replace("--", ""), String::from("")); - } - } else if !only_options_left { - path.push_str(&format!("/{argument}")) - } - } - - self.execute_path(&path, &argument_map); - } - - fn preapare_env_path() { env::set_var("PATH", fs_util::docki_path_env()); - } - fn execute_path(self, path: &String, args: &HashMap) { - let command = self.command_regisrty.command_by(path); - - if let Some(c) = command { - self.execute_command(c, args) - } else { - println!("command not found") + match args.command { + CommandArg::Build => build(), + CommandArg::Health => health(), + CommandArg::InstallReveal => install_reveal() } } - fn execute_command(&self, c: &Box, args: &HashMap) { - let result = c.execute(args); - - match result { - Ok(_) => println!("successfully executed"), - Err(message) => println!("{message}") - } + pub fn new() -> Self { + Self {} } + } diff --git a/src/main.rs b/src/main.rs index a5101bc..a7b2550 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,12 +3,9 @@ mod app; #[cfg(test)] mod test; -use std::env; - use app::App; fn main() { let app = App::new(); - let args = env::args().collect(); - app.start(args); + app.start(); } diff --git a/src/test/fs_util.rs b/src/test/fs_util.rs index 6cd4a88..3181e76 100644 --- a/src/test/fs_util.rs +++ b/src/test/fs_util.rs @@ -1,5 +1,3 @@ -use std::{fs, path::Path}; - use crate::app::fs_util; #[test] From 95463214656cc67762868dbe86fe829fbf481edc Mon Sep 17 00:00:00 2001 From: quirinecker Date: Wed, 8 Mar 2023 21:42:52 +0100 Subject: [PATCH 05/21] extracted environment variable setup into function --- src/app/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index 8dfa61c..2b5e304 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -16,7 +16,7 @@ impl App { pub fn start(&self) { let args = args(); - env::set_var("PATH", fs_util::docki_path_env()); + Self::setup_environment_variables(); match args.command { CommandArg::Build => build(), @@ -25,6 +25,10 @@ impl App { } } + fn setup_environment_variables() { + env::set_var("PATH", fs_util::docki_path_env()); + } + pub fn new() -> Self { Self {} } From 7bce49a8a9b92cc6ed07575877525b4a64469d2b Mon Sep 17 00:00:00 2001 From: quirinecker Date: Wed, 8 Mar 2023 21:47:15 +0100 Subject: [PATCH 06/21] added a little bit of documentation for the commands --- src/app/args/structure.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/args/structure.rs b/src/app/args/structure.rs index f048ecc..3ec5d63 100644 --- a/src/app/args/structure.rs +++ b/src/app/args/structure.rs @@ -8,7 +8,10 @@ pub struct Args { #[derive(Subcommand)] pub enum CommandArg { + /// Builds the documentation into a dist folder Build, + /// Checks if everything required for docki is installed Health, + /// Helper command for installing asciidoctor-reveal-js InstallReveal } From fb147e585718064734c576de101ffff1f9b25a61 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Thu, 9 Mar 2023 17:47:38 +0100 Subject: [PATCH 07/21] added the serve command --- src/app/args/structure.rs | 4 +++- src/app/commands/mod.rs | 3 +-- src/app/commands/serve.rs | 15 ++------------- src/app/mod.rs | 4 +++- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/app/args/structure.rs b/src/app/args/structure.rs index 3ec5d63..d2c4442 100644 --- a/src/app/args/structure.rs +++ b/src/app/args/structure.rs @@ -13,5 +13,7 @@ pub enum CommandArg { /// Checks if everything required for docki is installed Health, /// Helper command for installing asciidoctor-reveal-js - InstallReveal + InstallReveal, + /// Starts a Webserver with the live preview of the Documentation + Serve } diff --git a/src/app/commands/mod.rs b/src/app/commands/mod.rs index cbf575e..fe8dae8 100644 --- a/src/app/commands/mod.rs +++ b/src/app/commands/mod.rs @@ -1,6 +1,5 @@ -pub mod traits; pub mod executions; pub mod build; pub mod health; pub mod install_reveal; -mod serve; +pub mod serve; diff --git a/src/app/commands/serve.rs b/src/app/commands/serve.rs index ca0fb3b..a501417 100644 --- a/src/app/commands/serve.rs +++ b/src/app/commands/serve.rs @@ -1,14 +1,3 @@ -use super::traits::Command; - -pub struct Serve; - -impl Command for Serve { - fn execute(&self, _args: &std::collections::HashMap) -> Result<(), String> { - println!("serving the application"); - return Ok(()) - } - - fn new() -> Self where Self: Sized { - return Self {} - } +pub fn serve() { + println!("serving the developement version") } diff --git a/src/app/mod.rs b/src/app/mod.rs index 2b5e304..d0bdcc8 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -9,6 +9,7 @@ use self::args::{args, structure::CommandArg}; use self::commands::build::build; use self::commands::health::health; use self::commands::install_reveal::install_reveal; +use self::commands::serve::serve; pub struct App; @@ -21,7 +22,8 @@ impl App { match args.command { CommandArg::Build => build(), CommandArg::Health => health(), - CommandArg::InstallReveal => install_reveal() + CommandArg::InstallReveal => install_reveal(), + CommandArg::Serve => serve() } } From cc77e4ef9c6b16c68e1ff30ac08e477dd4b3e043 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Sun, 12 Mar 2023 19:30:11 +0100 Subject: [PATCH 08/21] implemented serve command and added async runtime --- Cargo.lock | 1908 ++++++++++++++++++++++++++++++++++++- Cargo.toml | 4 + src/app/commands/serve.rs | 111 ++- src/app/mod.rs | 10 +- src/main.rs | 5 +- 5 files changed, 1994 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b0bdb4d..4bf78ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,60 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher", +] + +[[package]] +name = "aes-gcm" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher", + "opaque-debug", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher", + "opaque-debug", +] + [[package]] name = "aho-corasick" version = "0.7.20" @@ -17,6 +71,255 @@ dependencies = [ "memchr", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "async-attributes" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "async-channel" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-dup" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7427a12b8dc09291528cfb1da2447059adb4a257388c2acd6497a79d55cf6f7c" +dependencies = [ + "futures-io", + "simple-mutex", +] + +[[package]] +name = "async-executor" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" +dependencies = [ + "async-lock", + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +dependencies = [ + "async-channel", + "async-executor", + "async-io", + "async-lock", + "blocking", + "futures-lite", + "once_cell", +] + +[[package]] +name = "async-h1" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8101020758a4fc3a7c326cb42aa99e9fa77cbfb76987c128ad956406fe1f70a7" +dependencies = [ + "async-channel", + "async-dup", + "async-std", + "futures-core", + "http-types", + "httparse", + "log", + "pin-project", +] + +[[package]] +name = "async-io" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" +dependencies = [ + "async-lock", + "autocfg", + "concurrent-queue", + "futures-lite", + "libc", + "log", + "parking", + "polling", + "slab", + "socket2", + "waker-fn", + "windows-sys 0.42.0", +] + +[[package]] +name = "async-lock" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-process" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6381ead98388605d0d9ff86371043b5aa922a3905824244de40dc263a14fcba4" +dependencies = [ + "async-io", + "async-lock", + "autocfg", + "blocking", + "cfg-if 1.0.0", + "event-listener", + "futures-lite", + "libc", + "signal-hook", + "windows-sys 0.42.0", +] + +[[package]] +name = "async-session" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345022a2eed092cd105cc1b26fd61c341e100bd5fcbbd792df4baf31c2cc631f" +dependencies = [ + "anyhow", + "async-std", + "async-trait", + "base64 0.12.3", + "bincode", + "blake3", + "chrono", + "hmac 0.8.1", + "kv-log-macro", + "rand 0.7.3", + "serde", + "serde_json", + "sha2", +] + +[[package]] +name = "async-sse" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53bba003996b8fd22245cd0c59b869ba764188ed435392cf2796d03b805ade10" +dependencies = [ + "async-channel", + "async-std", + "http-types", + "log", + "memchr", + "pin-project-lite 0.1.12", +] + +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-attributes", + "async-channel", + "async-global-executor", + "async-io", + "async-lock", + "async-process", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite 0.2.9", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" + +[[package]] +name = "async-trait" +version = "0.1.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b84f9ebcc6c1f5b8cb160f6990096a5c127f423fcb6e1ccc46c370cbdfb75dfc" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-tungstenite" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07b30ef0ea5c20caaa54baea49514a206308989c68be7ecd86c7f956e4da6378" +dependencies = [ + "futures-io", + "futures-util", + "log", + "pin-project-lite 0.2.9", + "tungstenite", +] + +[[package]] +name = "atomic-waker" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" + [[package]] name = "atty" version = "0.2.14" @@ -25,7 +328,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi 0.1.19", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -34,18 +337,83 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "blake3" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if 0.1.10", + "constant_time_eq", + "crypto-mac 0.8.0", + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "blocking" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", +] + [[package]] name = "bumpalo" version = "3.12.0" @@ -91,12 +459,60 @@ version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-integer", + "num-traits", + "serde", + "time 0.1.45", + "wasm-bindgen", + "winapi 0.3.9", +] + +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array", +] + +[[package]] +name = "clap" +version = "3.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +dependencies = [ + "atty", + "bitflags", + "clap_derive 3.2.18", + "clap_lex 0.2.4", + "indexmap", + "once_cell", + "strsim", + "termcolor", + "textwrap", +] + [[package]] name = "clap" version = "4.1.8" @@ -104,14 +520,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5" dependencies = [ "bitflags", - "clap_derive", - "clap_lex", + "clap_derive 4.1.8", + "clap_lex 0.3.2", "is-terminal", "once_cell", "strsim", "termcolor", ] +[[package]] +name = "clap_derive" +version = "3.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "clap_derive" version = "4.1.8" @@ -125,6 +554,15 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "clap_lex" version = "0.3.2" @@ -134,6 +572,16 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + [[package]] name = "colored" version = "2.0.0" @@ -142,7 +590,45 @@ checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" dependencies = [ "atty", "lazy_static", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "concurrent-queue" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "const_fn" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "cookie" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951" +dependencies = [ + "aes-gcm", + "base64 0.13.1", + "hkdf", + "hmac 0.10.1", + "percent-encoding", + "rand 0.8.5", + "sha2", + "time 0.2.27", + "version_check", ] [[package]] @@ -161,26 +647,162 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "cpufeatures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +dependencies = [ + "libc", +] + +[[package]] +name = "cpuid-bool" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" + [[package]] name = "crc32fast" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "crypto-mac" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "ctor" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "ctr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" +dependencies = [ + "cipher", +] + +[[package]] +name = "cxx" +version = "1.0.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a140f260e6f3f79013b8bfc65e7ce630c9ab4388c6a89c71e07226f49487b72" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da6383f459341ea689374bf0a42979739dc421874f112ff26f829b8040b8e613" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90201c1a650e95ccff1c8c0bb5a343213bdd317c6e600a93075bca2eff54ec97" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b75aed41bb2e6367cae39e6326ef817a851db13c13e4f3263714ca3cfb8de56" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "docki" version = "0.3.0" dependencies = [ "bytes", - "clap", + "clap 4.1.8", "colored", + "futures", "home", + "live-server", + "notify 5.1.0", "regex", "reqwest", "text_io", + "tokio", "zip-extract", ] @@ -190,7 +812,29 @@ version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", +] + +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "erased-serde" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2b0c2380453a92ea8b6c8e5f64ecaafccddde8ceab55ff7a8ac1029f894569" +dependencies = [ + "serde", ] [[package]] @@ -201,7 +845,7 @@ checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" dependencies = [ "errno-dragonfly", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -214,6 +858,12 @@ dependencies = [ "libc", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fastrand" version = "1.8.0" @@ -223,6 +873,34 @@ dependencies = [ "instant", ] +[[package]] +name = "femme" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc04871e5ae3aa2952d552dae6b291b3099723bf779a8054281c1366a54613ef" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "filetime" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "windows-sys 0.45.0", +] + [[package]] name = "flate2" version = "1.0.25" @@ -263,6 +941,65 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fsevent" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" +dependencies = [ + "bitflags", + "fsevent-sys 2.0.1", +] + +[[package]] +name = "fsevent-sys" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" +dependencies = [ + "libc", +] + +[[package]] +name = "fsevent-sys" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" +dependencies = [ + "libc", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.26" @@ -270,6 +1007,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -278,12 +1016,49 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" +[[package]] +name = "futures-executor" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + [[package]] name = "futures-io" version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" +[[package]] +name = "futures-lite" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite 0.2.9", + "waker-fn", +] + +[[package]] +name = "futures-macro" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "futures-sink" version = "0.3.26" @@ -302,15 +1077,72 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ + "futures-channel", "futures-core", "futures-io", + "futures-macro", + "futures-sink", "futures-task", "memchr", - "pin-project-lite", + "pin-project-lite 0.2.9", "pin-utils", "slab", ] +[[package]] +name = "generic-array" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "ghash" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" +dependencies = [ + "opaque-debug", + "polyval", +] + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "h2" version = "0.3.15" @@ -366,13 +1198,43 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +[[package]] +name = "hkdf" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f" +dependencies = [ + "digest", + "hmac 0.10.1", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest", +] + +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac 0.10.0", + "digest", +] + [[package]] name = "home" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -394,7 +1256,41 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", - "pin-project-lite", + "pin-project-lite 0.2.9", +] + +[[package]] +name = "http-client" +version = "6.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1947510dc91e2bf586ea5ffb412caad7673264e14bb39fb9078da114a94ce1a5" +dependencies = [ + "async-trait", + "cfg-if 1.0.0", + "http-types", + "log", +] + +[[package]] +name = "http-types" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad" +dependencies = [ + "anyhow", + "async-channel", + "async-std", + "base64 0.13.1", + "cookie", + "futures-lite", + "infer", + "pin-project-lite 0.2.9", + "rand 0.7.3", + "serde", + "serde_json", + "serde_qs", + "serde_urlencoded", + "url", ] [[package]] @@ -409,6 +1305,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "0.14.24" @@ -425,7 +1327,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite", + "pin-project-lite 0.2.9", "socket2", "tokio", "tower-service", @@ -446,6 +1348,30 @@ dependencies = [ "tokio-native-tls", ] +[[package]] +name = "iana-time-zone" +version = "0.1.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "winapi 0.3.9", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + [[package]] name = "idna" version = "0.3.0" @@ -466,13 +1392,59 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "infer" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac" + +[[package]] +name = "inotify" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" +dependencies = [ + "bitflags", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" +dependencies = [ + "bitflags", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + +[[package]] +name = "input_buffer" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413" +dependencies = [ + "bytes", +] + [[package]] name = "instant" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -485,6 +1457,15 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + [[package]] name = "ipnet" version = "2.7.1" @@ -518,31 +1499,127 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "kqueue" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8fc60ba15bf51257aa9807a48a61013db043fcf3a78cb0d916e8e396dcad98" +dependencies = [ + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +[[package]] +name = "link-cplusplus" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] + [[package]] name = "linux-raw-sys" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +[[package]] +name = "live-server" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9146a2536ec048f2f7b6d374f3e74efc7cd0fad4a3030ebb5c2e474f015d1a" +dependencies = [ + "async-std", + "clap 3.2.23", + "env_logger", + "local-ip-address", + "log", + "mime_guess", + "notify 4.0.17", + "tide", + "tide-websockets", + "uuid", +] + +[[package]] +name = "local-ip-address" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faa9d02443a1741e9f51dafdfcbffb3863b2a89c457d762b40337d6c5153ef81" +dependencies = [ + "libc", + "neli", + "thiserror", + "windows-sys 0.42.0", +] + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", + "serde", + "value-bag", ] [[package]] @@ -557,6 +1634,16 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "miniz_oxide" version = "0.6.2" @@ -566,6 +1653,25 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", +] + [[package]] name = "mio" version = "0.8.5" @@ -578,6 +1684,30 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "mio-extras" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" +dependencies = [ + "lazycell", + "log", + "mio 0.6.23", + "slab", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + [[package]] name = "native-tls" version = "0.2.11" @@ -596,6 +1726,83 @@ dependencies = [ "tempfile", ] +[[package]] +name = "neli" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9053554eb5dcb7e10d9cdab1206965bde870eed5d0d341532ca035e3ba221508" +dependencies = [ + "byteorder", + "libc", +] + +[[package]] +name = "net2" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "notify" +version = "4.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257" +dependencies = [ + "bitflags", + "filetime", + "fsevent", + "fsevent-sys 2.0.1", + "inotify 0.7.1", + "libc", + "mio 0.6.23", + "mio-extras", + "walkdir", + "winapi 0.3.9", +] + +[[package]] +name = "notify" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58ea850aa68a06e48fdb069c0ec44d0d64c8dbffa49bf3b6f7f0a901fdea1ba9" +dependencies = [ + "bitflags", + "crossbeam-channel", + "filetime", + "fsevent-sys 4.1.0", + "inotify 0.9.6", + "kqueue", + "libc", + "mio 0.8.5", + "serde", + "walkdir", + "windows-sys 0.42.0", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + [[package]] name = "num_cpus" version = "1.15.0" @@ -612,6 +1819,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "openssl" version = "0.10.45" @@ -619,7 +1832,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ "bitflags", - "cfg-if", + "cfg-if 1.0.0", "foreign-types", "libc", "once_cell", @@ -663,12 +1876,67 @@ version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.45.0", +] + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -687,6 +1955,39 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +[[package]] +name = "polling" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e1f879b2998099c2d69ab9605d145d5b661195627eccc680002c4918a7fb6fa" +dependencies = [ + "autocfg", + "bitflags", + "cfg-if 1.0.0", + "concurrent-queue", + "libc", + "log", + "pin-project-lite 0.2.9", + "windows-sys 0.45.0", +] + +[[package]] +name = "polyval" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" +dependencies = [ + "cpuid-bool", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -711,6 +2012,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + [[package]] name = "proc-macro2" version = "1.0.50" @@ -729,6 +2036,77 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.8", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -761,7 +2139,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -770,7 +2148,7 @@ version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" dependencies = [ - "base64", + "base64 0.21.0", "bytes", "encoding_rs", "futures-core", @@ -787,7 +2165,7 @@ dependencies = [ "native-tls", "once_cell", "percent-encoding", - "pin-project-lite", + "pin-project-lite 0.2.9", "serde", "serde_json", "serde_urlencoded", @@ -801,6 +2179,21 @@ dependencies = [ "winreg", ] +[[package]] +name = "route-recognizer" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56770675ebc04927ded3e60633437841581c285dc6236109ea25fbf3beb7b59e" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.36.9" @@ -821,6 +2214,15 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "schannel" version = "0.1.21" @@ -830,6 +2232,18 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "scratch" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" + [[package]] name = "security-framework" version = "2.8.2" @@ -853,11 +2267,49 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_fmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2963a69a2b3918c1dc75a45a18bd3fcd1120e31d3f59deb1b2f9b5d5ffb8baa4" +dependencies = [ + "serde", +] [[package]] name = "serde_json" @@ -870,6 +2322,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_qs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" +dependencies = [ + "percent-encoding", + "serde", + "thiserror", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -882,6 +2345,75 @@ dependencies = [ "serde", ] +[[package]] +name = "sha-1" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +dependencies = [ + "block-buffer", + "cfg-if 1.0.0", + "cpufeatures", + "digest", + "opaque-debug", +] + +[[package]] +name = "sha1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1_smol" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer", + "cfg-if 1.0.0", + "cpufeatures", + "digest", + "opaque-debug", +] + +[[package]] +name = "signal-hook" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "simple-mutex" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38aabbeafa6f6dead8cebf246fe9fae1f9215c8d29b3a69f93bd62a9e4a3dcd6" +dependencies = [ + "event-listener", +] + [[package]] name = "slab" version = "0.4.7" @@ -891,6 +2423,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + [[package]] name = "socket2" version = "0.4.7" @@ -898,15 +2436,88 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "sval" +version = "1.0.0-alpha.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45f6ee7c7b87caf59549e9fe45d6a69c75c8019e79e212a835c5da0e92f0ba08" +dependencies = [ + "serde", +] + [[package]] name = "syn" version = "1.0.107" @@ -924,12 +2535,12 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "fastrand", "libc", "redox_syscall", "remove_dir_all", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -947,6 +2558,12 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f0c8eb2ad70c12a6a69508f499b3051c924f4b1cfeae85bfad96e6bc5bba46" +[[package]] +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + [[package]] name = "thiserror" version = "1.0.38" @@ -967,6 +2584,47 @@ dependencies = [ "syn", ] +[[package]] +name = "tide" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c459573f0dd2cc734b539047f57489ea875af8ee950860ded20cf93a79a1dee0" +dependencies = [ + "async-h1", + "async-session", + "async-sse", + "async-std", + "async-trait", + "femme", + "futures-util", + "http-client", + "http-types", + "kv-log-macro", + "log", + "pin-project-lite 0.2.9", + "route-recognizer", + "serde", + "serde_json", +] + +[[package]] +name = "tide-websockets" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3592c5cb5cb1b7a2ff3a0e5353170c1bb5b104b2f66dd06f73304169b52cc725" +dependencies = [ + "async-dup", + "async-std", + "async-tungstenite", + "base64 0.13.1", + "futures-util", + "pin-project", + "serde", + "serde_json", + "sha-1", + "tide", +] + [[package]] name = "time" version = "0.1.45" @@ -975,7 +2633,45 @@ checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "time" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check", + "winapi 0.3.9", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn", ] [[package]] @@ -995,19 +2691,33 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.25.0" +version = "1.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" dependencies = [ "autocfg", "bytes", "libc", "memchr", - "mio", + "mio 0.8.5", "num_cpus", - "pin-project-lite", + "parking_lot", + "pin-project-lite 0.2.9", + "signal-hook-registry", "socket2", - "windows-sys 0.42.0", + "tokio-macros", + "windows-sys 0.45.0", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1029,7 +2739,7 @@ dependencies = [ "bytes", "futures-core", "futures-sink", - "pin-project-lite", + "pin-project-lite 0.2.9", "tokio", "tracing", ] @@ -1046,8 +2756,8 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if", - "pin-project-lite", + "cfg-if 1.0.0", + "pin-project-lite 0.2.9", "tracing-core", ] @@ -1066,6 +2776,41 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +[[package]] +name = "tungstenite" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fe8dada8c1a3aeca77d6b51a4f1314e0f4b8e438b7b1b71e3ddaca8080e4093" +dependencies = [ + "base64 0.13.1", + "byteorder", + "bytes", + "http", + "httparse", + "input_buffer", + "log", + "rand 0.8.5", + "sha-1", + "thiserror", + "url", + "utf-8", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.10" @@ -1087,6 +2832,22 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "universal-hash" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "url" version = "2.3.1" @@ -1096,6 +2857,36 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "uuid" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +dependencies = [ + "getrandom 0.2.8", +] + +[[package]] +name = "value-bag" +version = "1.0.0-alpha.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" +dependencies = [ + "ctor", + "erased-serde", + "serde", + "serde_fmt", + "sval", + "version_check", ] [[package]] @@ -1110,6 +2901,23 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi 0.3.9", + "winapi-util", +] + [[package]] name = "want" version = "0.3.0" @@ -1120,6 +2928,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -1138,7 +2952,9 @@ version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", + "serde", + "serde_json", "wasm-bindgen-macro", ] @@ -1163,7 +2979,7 @@ version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -1208,6 +3024,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -1218,6 +3040,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1230,7 +3058,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1326,7 +3154,17 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", ] [[package]] @@ -1340,7 +3178,7 @@ dependencies = [ "crc32fast", "flate2", "thiserror", - "time", + "time 0.1.45", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index cda3610..acffad0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,12 @@ license-file = "LICENSE.txt" bytes = "1.4.0" clap = { version = "4.1.8", features = ["derive"] } colored = "2.0.0" +futures = "0.3.26" home = "0.5.4" +live-server = "0.6.0" +notify = { version = "5.1.0", features = ["serde"] } regex = "1.7.1" reqwest = { version = "0.11.14", features = ["blocking"] } text_io = "0.1.12" +tokio = { version = "1.26.0", features = ["full"] } zip-extract = "0.1.1" diff --git a/src/app/commands/serve.rs b/src/app/commands/serve.rs index a501417..bec5418 100644 --- a/src/app/commands/serve.rs +++ b/src/app/commands/serve.rs @@ -1,3 +1,110 @@ -pub fn serve() { - println!("serving the developement version") +use colored::Colorize; +use live_server::listen; +use notify::{ + event::{self, ModifyKind}, + Config, Event, EventKind, RecommendedWatcher, RecursiveMode, Watcher, +}; +use std::{env, path::Path}; +use tokio::sync::mpsc::{channel, Receiver}; + +use crate::app::{ + builder::{ + asciidoctor::{AsciiDoctorDocsBuilder, AsciiDoctorSlideBuilder}, + Builder, + }, + fs_util, +}; + +pub async fn serve() { + tokio::join!(watch_and_build(), start_server()); + + println!("stopping live server"); +} + +async fn watch_and_build() { + watch(Path::new("./docs")) + .await + .expect("something went wrong") +} + +async fn start_server() { + println!("Serving at http://localhost:8080"); + + let Ok(()) = listen("localhost", 8080, "./dist").await else { + panic!("could not start server") + }; +} + +async fn watch(path: &Path) -> notify::Result<()> { + let (mut watcher, mut rx) = watcher()?; + + watcher.watch(path.as_ref(), RecursiveMode::Recursive)?; + + while let Some(res) = rx.recv().await { + match res { + Ok(event) => file_change(event), + Err(e) => println!("watch error: {:?}", e), + } + } + + Ok(()) +} + +fn file_change(event: Event) { + match event.kind { + EventKind::Modify(ModifyKind::Data(_)) => { + build_file(event.paths).expect("building file failed"); + () + } + _ => (), + } +} + +fn build_file(paths: Vec) -> Result<(), String> { + let invalid_path_message = "changed path is invalid"; + let in_path = paths + .first() + .expect(invalid_path_message) + .to_str() + .expect(invalid_path_message) + .replace(¤t_dir(), "") + .replace("/./", "./"); + let out_path = in_path + .replace("./docs/", "./dist/") + .replace(".adoc", ".html"); + + println!("{} {}", "[Rebuilding]".green(), in_path); + + if in_path.starts_with("./docs/slides") { + let slide_builder = AsciiDoctorSlideBuilder {}; + slide_builder.build(&in_path, &out_path) + } else { + let doc_builder = AsciiDoctorDocsBuilder {}; + doc_builder.build(&in_path, &out_path) + } +} + +fn current_dir() -> String { + let err_message = "something went wrong"; + return String::from( + env::current_dir() + .expect(err_message) + .to_str() + .expect(err_message), + ); +} + +fn watcher() -> notify::Result<(RecommendedWatcher, Receiver>)> { + let (tx, rx) = channel(1); + + let watcher = RecommendedWatcher::new( + move |res| { + futures::executor::block_on(async { + tx.send(res).await.unwrap(); + }); + }, + Config::default(), + )?; + + Ok((watcher, rx)) } diff --git a/src/app/mod.rs b/src/app/mod.rs index d0bdcc8..b12e39b 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -15,16 +15,16 @@ pub struct App; impl App { - pub fn start(&self) { + pub async fn start(&self) { let args = args(); Self::setup_environment_variables(); match args.command { - CommandArg::Build => build(), + CommandArg::Build => build().await, CommandArg::Health => health(), - CommandArg::InstallReveal => install_reveal(), - CommandArg::Serve => serve() - } + CommandArg::InstallReveal => install_reveal().await, + CommandArg::Serve => serve().await + }; } fn setup_environment_variables() { diff --git a/src/main.rs b/src/main.rs index a7b2550..370eaa3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,8 @@ mod test; use app::App; -fn main() { +#[tokio::main] +async fn main() { let app = App::new(); - app.start(); + app.start().await; } From f0007394c300e0c84b9cef0a36d798635c548765 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Sun, 12 Mar 2023 21:17:51 +0100 Subject: [PATCH 09/21] added async stuff not pushed in the last commit --- src/app/commands/build.rs | 4 ++-- src/app/commands/executions/build_execution.rs | 6 +++--- src/app/commands/install_reveal.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/commands/build.rs b/src/app/commands/build.rs index 2e9161d..c3fe698 100644 --- a/src/app/commands/build.rs +++ b/src/app/commands/build.rs @@ -1,6 +1,6 @@ use super::executions::build_execution::BuildExecution; -pub fn build() -> () { +pub async fn build() -> () { let mut build_execution = BuildExecution::new(); - build_execution.execute().expect("build failed") + build_execution.execute().await.expect("build failed") } diff --git a/src/app/commands/executions/build_execution.rs b/src/app/commands/executions/build_execution.rs index dd466f9..8604cc0 100644 --- a/src/app/commands/executions/build_execution.rs +++ b/src/app/commands/executions/build_execution.rs @@ -25,14 +25,14 @@ impl BuildExecution { }; } - pub fn execute(&mut self) -> Result<(), String> { + pub async fn execute(&mut self) -> Result<(), String> { let path = "./docs/".to_string(); if !Self::directory_exists(&path) { return Err("docs directory does not exist it. Create it or use the template".to_string()) } - if let Err(error) = Self::prepare() { + if let Err(error) = Self::prepare().await { return Err(error); } @@ -100,7 +100,7 @@ impl BuildExecution { self.build_file_and_status(&self.doc_builder, in_path, out_path, "doc"); } - fn prepare() -> Result<(), String> { + async fn prepare() -> Result<(), String> { let reveal_version = "3.9.2"; let target = format!("https://github.com/hakimel/reveal.js/archive/{reveal_version}.zip"); diff --git a/src/app/commands/install_reveal.rs b/src/app/commands/install_reveal.rs index de38a0f..01569d0 100644 --- a/src/app/commands/install_reveal.rs +++ b/src/app/commands/install_reveal.rs @@ -4,7 +4,7 @@ use crate::app::fs_util; const ASCIIDOC_REVEAL_VERSION: &str= "v4.1.0-rc.5"; -pub fn install_reveal() -> () { +pub async fn install_reveal() -> () { let result = reqwest::blocking::get(url()) .expect("Could not download reveal. Make sure you are connected to the internet"); From a1c1458a615ead416913e0556c49aaa89f0e1540 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Sun, 12 Mar 2023 21:24:26 +0100 Subject: [PATCH 10/21] removed warnings --- src/app/commands/serve.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/app/commands/serve.rs b/src/app/commands/serve.rs index bec5418..51b2a0c 100644 --- a/src/app/commands/serve.rs +++ b/src/app/commands/serve.rs @@ -1,20 +1,18 @@ use colored::Colorize; use live_server::listen; use notify::{ - event::{self, ModifyKind}, + event::ModifyKind, Config, Event, EventKind, RecommendedWatcher, RecursiveMode, Watcher, }; use std::{env, path::Path}; use tokio::sync::mpsc::{channel, Receiver}; -use crate::app::{ - builder::{ +use crate::app::builder::{ asciidoctor::{AsciiDoctorDocsBuilder, AsciiDoctorSlideBuilder}, Builder, - }, - fs_util, }; + pub async fn serve() { tokio::join!(watch_and_build(), start_server()); From 125a9f0fe92a0239f1a39e2c1ed5c7d558d73fca Mon Sep 17 00:00:00 2001 From: quirinecker Date: Sun, 12 Mar 2023 21:44:42 +0100 Subject: [PATCH 11/21] made some refactoring --- src/app/commands/serve.rs | 30 +++++++----------------------- src/app/mod.rs | 1 + src/app/watcher/mod.rs | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 23 deletions(-) create mode 100644 src/app/watcher/mod.rs diff --git a/src/app/commands/serve.rs b/src/app/commands/serve.rs index 51b2a0c..59e00a6 100644 --- a/src/app/commands/serve.rs +++ b/src/app/commands/serve.rs @@ -1,16 +1,16 @@ use colored::Colorize; +use futures::StreamExt; use live_server::listen; use notify::{ event::ModifyKind, - Config, Event, EventKind, RecommendedWatcher, RecursiveMode, Watcher, + Event, EventKind, RecursiveMode, Watcher, }; use std::{env, path::Path}; -use tokio::sync::mpsc::{channel, Receiver}; -use crate::app::builder::{ +use crate::app::{builder::{ asciidoctor::{AsciiDoctorDocsBuilder, AsciiDoctorSlideBuilder}, Builder, -}; +}, watcher::watcher}; pub async fn serve() { @@ -38,11 +38,9 @@ async fn watch(path: &Path) -> notify::Result<()> { watcher.watch(path.as_ref(), RecursiveMode::Recursive)?; - while let Some(res) = rx.recv().await { - match res { - Ok(event) => file_change(event), - Err(e) => println!("watch error: {:?}", e), - } + while let Some(res) = rx.next().await { + let event = res.expect("watching failed"); + file_change(event) } Ok(()) @@ -92,17 +90,3 @@ fn current_dir() -> String { ); } -fn watcher() -> notify::Result<(RecommendedWatcher, Receiver>)> { - let (tx, rx) = channel(1); - - let watcher = RecommendedWatcher::new( - move |res| { - futures::executor::block_on(async { - tx.send(res).await.unwrap(); - }); - }, - Config::default(), - )?; - - Ok((watcher, rx)) -} diff --git a/src/app/mod.rs b/src/app/mod.rs index b12e39b..2f01bea 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,6 +1,7 @@ mod commands; pub mod builder; pub mod fs_util; +pub mod watcher; mod args; use std::env; diff --git a/src/app/watcher/mod.rs b/src/app/watcher/mod.rs new file mode 100644 index 0000000..b87393c --- /dev/null +++ b/src/app/watcher/mod.rs @@ -0,0 +1,17 @@ +use futures::{channel::mpsc::{Receiver, channel}, SinkExt}; +use notify::{RecommendedWatcher, Event, Watcher, Config}; + +pub fn watcher() -> notify::Result<(RecommendedWatcher, Receiver>)> { + let (mut tx, rx) = channel(1); + + let watcher = RecommendedWatcher::new( + move |res| { + futures::executor::block_on(async { + tx.send(res).await.unwrap(); + }); + }, + Config::default(), + )?; + + Ok((watcher, rx)) +} From f18ce995bb0b61c9c2ffc59fc7895d70bc8fae0b Mon Sep 17 00:00:00 2001 From: quirinecker Date: Sun, 12 Mar 2023 22:01:47 +0100 Subject: [PATCH 12/21] removed unreachable log --- src/app/commands/serve.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/commands/serve.rs b/src/app/commands/serve.rs index 59e00a6..b1475d5 100644 --- a/src/app/commands/serve.rs +++ b/src/app/commands/serve.rs @@ -15,8 +15,6 @@ use crate::app::{builder::{ pub async fn serve() { tokio::join!(watch_and_build(), start_server()); - - println!("stopping live server"); } async fn watch_and_build() { From 96c6c8d94d7c6cb142164e426e967c67a96960c5 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Sun, 12 Mar 2023 23:13:08 +0100 Subject: [PATCH 13/21] refactored building of documents --- src/app/{builder => build}/asciidoctor.rs | 62 ++++----- src/app/build/mod.rs | 55 ++++++++ src/app/builder/mod.rs | 5 - .../commands/executions/build_execution.rs | 130 +++++------------- src/app/commands/serve.rs | 17 +-- src/app/fs_util/mod.rs | 1 + src/app/mod.rs | 2 +- 7 files changed, 119 insertions(+), 153 deletions(-) rename src/app/{builder => build}/asciidoctor.rs (63%) create mode 100644 src/app/build/mod.rs delete mode 100644 src/app/builder/mod.rs diff --git a/src/app/builder/asciidoctor.rs b/src/app/build/asciidoctor.rs similarity index 63% rename from src/app/builder/asciidoctor.rs rename to src/app/build/asciidoctor.rs index e18b680..f3a17c5 100644 --- a/src/app/builder/asciidoctor.rs +++ b/src/app/build/asciidoctor.rs @@ -2,8 +2,6 @@ use std::process; use regex::Regex; -use super::Builder; - fn exec_command(command: &mut process::Command) -> Result<(), String> { let result = command.output(); @@ -11,11 +9,13 @@ fn exec_command(command: &mut process::Command) -> Result<(), String> { if success.stderr.len() == 0 { return Ok(()); } else { - return Err(AsciiDoctorDocsBuilder::from_utf8(success.stderr)); + return Err(from_utf8(success.stderr)); } } else { println!("{}", result.unwrap_err()); - return Err("asciidoctor not installed. For more information run docki health!".to_string()); + return Err( + "asciidoctor not installed. For more information run docki health!".to_string(), + ); } } @@ -50,30 +50,34 @@ fn parent_path(child_path: &str) -> String { } pub fn path_between(from: String, to: String) -> String { - let from_segments = transform_input_to_clone_split(&from); + let from_segments = transform_input_to_clone_split(&from); let to_segments = transform_input_to_clone_split(&to); let last_matching_index = matching_from_start(&from_segments, &to_segments); let number_of_backs = from_segments.len() - last_matching_index; let mut path_between = path_back(number_of_backs); let path_to_to_path = &to_segments[last_matching_index..]; path_between.push_str(&path_to_to_path.join("/")); - return path_between; + return path_between; } fn transform_input_to_clone_split(input: &String) -> Vec { let regex = Regex::new(r"/$").unwrap(); let first_transformation = input.clone().replace("./", ""); - return regex.replace_all(&first_transformation, "") - .to_string().split("/") + return regex + .replace_all(&first_transformation, "") + .to_string() + .split("/") .collect::>() - .iter().map(|s| s.to_string()).collect() + .iter() + .map(|s| s.to_string()) + .collect(); } fn path_back(count: usize) -> String { let mut path = "".to_string(); - for _ in 0..count { - path.push_str("../"); + for _ in 0..count { + path.push_str("../"); } return path; @@ -81,8 +85,8 @@ fn path_back(count: usize) -> String { pub fn matching_from_start(from_segments: &Vec, to_segments: &Vec) -> usize { for (index, from_segment) in from_segments.iter().enumerate() { - if let Some(to_segment) = to_segments.get(index){ - if from_segment != to_segment { + if let Some(to_segment) = to_segments.get(index) { + if from_segment != to_segment { return index; } } else { @@ -93,29 +97,19 @@ pub fn matching_from_start(from_segments: &Vec, to_segments: &Vec Result<(), String> { - let mut command = asciidoctor_docs(in_path, out_path); - return exec_command(&mut command); - } +pub fn build_doc(in_path: &str, out_path: &str) -> Result<(), String> { + let mut command = asciidoctor_docs(in_path, out_path); + return exec_command(&mut command); } -impl AsciiDoctorDocsBuilder { - fn from_utf8(input: Vec) -> String { - return match String::from_utf8(input) { - Ok(m) => m, - Err(e) => panic!("could not print error message: {}", e), - }; - } +pub fn build_slide(in_path: &str, out_path: &str) -> Result<(), String> { + let mut command = asciidoctor_slides(in_path, out_path); + return exec_command(&mut command); } -pub struct AsciiDoctorSlideBuilder; - -impl Builder for AsciiDoctorSlideBuilder { - fn build(&self, in_path: &str, out_path: &str) -> Result<(), String> { - let mut command = asciidoctor_slides(in_path, out_path); - return exec_command(&mut command); - } +fn from_utf8(input: Vec) -> String { + return match String::from_utf8(input) { + Ok(m) => m, + Err(e) => panic!("could not print error message: {}", e), + }; } diff --git a/src/app/build/mod.rs b/src/app/build/mod.rs new file mode 100644 index 0000000..5ff595a --- /dev/null +++ b/src/app/build/mod.rs @@ -0,0 +1,55 @@ +use std::fs; + +use self::asciidoctor::{build_doc, build_slide}; + +use super::fs_util; + +pub mod asciidoctor; + +pub trait Builder { + fn build(&self, in_path: &str, out_path: &str) -> Result<(), String>; +} + +pub fn docki_build(in_path: &str) -> DockiBuildResult { + let out_path = in_path.replace("/docs/", "/dist/"); + let convert_out_path = out_path.replace(".adoc", ".html"); + + if in_path.starts_with("./docs/slides/") && in_path.ends_with(".adoc") { + if let Err(err) = build_slide(&in_path, &convert_out_path) { + return DockiBuildResult::Err(err); + } + + DockiBuildResult::Slide(convert_out_path) + } else if in_path.ends_with(".adoc") { + if let Err(err) = build_doc(&in_path, &convert_out_path) { + return DockiBuildResult::Err(err); + } + + DockiBuildResult::Doc(convert_out_path) + } else { + if let Err(err) = copy(&in_path, &out_path) { + return DockiBuildResult::Err(err); + } + + DockiBuildResult::Copy(out_path) + } +} + +fn copy(in_path: &str, out_path: &str) -> Result<(), String> { + let segments: &Vec<&str> = &out_path.split("/").collect(); + let parent_dir = &segments[0..segments.len() - 1].join("/"); + fs_util::create_dir_recursive(parent_dir); + + if let Err(err) = fs::copy(in_path, out_path) { + return Err(err.to_string()) + } + + Ok(()) +} + +pub enum DockiBuildResult { + Slide(String), + Doc(String), + Copy(String), + Err(String), +} diff --git a/src/app/builder/mod.rs b/src/app/builder/mod.rs deleted file mode 100644 index 6f4cdff..0000000 --- a/src/app/builder/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod asciidoctor; - -pub trait Builder { - fn build(&self, in_path: &str, out_path: &str) -> Result<(), String>; -} diff --git a/src/app/commands/executions/build_execution.rs b/src/app/commands/executions/build_execution.rs index 8604cc0..f30cc92 100644 --- a/src/app/commands/executions/build_execution.rs +++ b/src/app/commands/executions/build_execution.rs @@ -1,18 +1,16 @@ -use std::{fs, path::{Path, PathBuf}, io::Cursor}; +use std::{ + io::Cursor, + path::PathBuf +}; use crate::app::{ - builder::{ - asciidoctor::{AsciiDoctorDocsBuilder, AsciiDoctorSlideBuilder}, - Builder, - }, + build::{docki_build, DockiBuildResult}, fs_util, }; pub struct BuildExecution { progress: usize, goal: usize, - doc_builder: Box, - slide_builder: Box, } impl BuildExecution { @@ -20,95 +18,35 @@ impl BuildExecution { return BuildExecution { progress: 0, goal: 0, - slide_builder: Box::new(AsciiDoctorSlideBuilder {}), - doc_builder: Box::new(AsciiDoctorDocsBuilder {}), }; } pub async fn execute(&mut self) -> Result<(), String> { let path = "./docs/".to_string(); - if !Self::directory_exists(&path) { - return Err("docs directory does not exist it. Create it or use the template".to_string()) + if !fs_util::directory_exists(&path) { + return Err( + "docs directory does not exist it. Create it or use the template".to_string(), + ); } if let Err(error) = Self::prepare().await { return Err(error); - } + } return self.build_dir(&path); } - fn build_file( - &self, - builder: &Box, - in_path: &str, - out_path: &str, - ) -> Result<(), String> { - return builder.build(&in_path, &out_path); - } - - fn build_file_and_status( - &self, - builder: &Box, - in_path: &str, - out_path: &str, - conversion_type: &str, - ) { - let result = self.build_file(builder, in_path, out_path); - if result.is_ok() { - self.display_status(in_path, out_path, conversion_type) - } else { - self.display_status(in_path, out_path, "error"); - let error = result.unwrap_err(); - println!("{error}"); - } - } - - fn copy(&self, in_path: &str, out_path: &str) { - let segments: &Vec<&str> = &out_path.split("/").collect(); - let parent_dir = &segments[0..segments.len() - 1].join("/"); - Self::create_dir_recursive(parent_dir); - let result = fs::copy(in_path, out_path); - if result.is_ok() { - self.display_status(in_path, out_path, "copy"); - } else { - self.display_status(in_path, out_path, "error"); - let error = result.unwrap_err(); - println!("{error}"); - } - } - - fn create_dir_recursive(path: &str) { - let mut validated_path = "./".to_string(); - for segment in path.split("/") { - validated_path.push_str(format!("{segment}/").as_str()); - if !Self::directory_exists(&validated_path) { - fs::create_dir(&validated_path).unwrap() - } - } - } - - fn display_status(&self, in_path: &str, out_path: &str, conversion_type: &str) -> () { - println!( - "({} / {}) [{}] {} -> {}", - self.progress, self.goal, conversion_type, in_path, out_path - ); - } - - fn build_doc(&self, in_path: &str, out_path: &str) { - self.build_file_and_status(&self.doc_builder, in_path, out_path, "doc"); - } async fn prepare() -> Result<(), String> { let reveal_version = "3.9.2"; let target = format!("https://github.com/hakimel/reveal.js/archive/{reveal_version}.zip"); - let Ok(response) = reqwest::blocking::get(target) else { + let Ok(response) = reqwest::get(target).await else { return Err("could not downlaod revealjs".to_string()) }; - let Ok(bytes) = response.bytes() else { + let Ok(bytes) = response.bytes().await else { return Err("could not extract bytes".to_string()) }; @@ -118,15 +56,7 @@ impl BuildExecution { return Err("could not write extracted archive to disk".to_string()); } - return Ok(()) - } - - fn build_slide(&self, in_path: &str, out_path: &str) { - self.build_file_and_status(&self.slide_builder, in_path, out_path, "slide"); - } - - fn directory_exists(path: &String) -> bool { - Path::new(path).is_dir() + return Ok(()); } fn build_dir(&mut self, path: &str) -> Result<(), String> { @@ -136,28 +66,30 @@ impl BuildExecution { return Err(result.unwrap_err()) }; - for (index, path) in paths.iter().enumerate() { + for (index, in_path) in paths.iter().enumerate() { self.progress = index + 1; self.goal = paths.len(); + let result = docki_build(&in_path); - if path.ends_with(".adoc") && path.starts_with("./docs/slides") { - let out_path = path - .clone() - .replace("adoc", "html") - .replace("/docs/", "/dist/"); - self.build_slide(&path, &out_path) - } else if path.ends_with(".adoc") { - let out_path = path - .clone() - .replace("adoc", "html") - .replace("/docs/", "/dist/"); - self.build_doc(&path, &out_path) - } else { - let out_path = path.clone().replace("/docs/", "/dist/"); - self.copy(&path, &out_path) + match result { + DockiBuildResult::Err(err) => { + self.display_status("Error", in_path, ""); + println!("{}", err) + }, + DockiBuildResult::Copy(out_path) => self.display_status("Copy", &in_path, &out_path), + DockiBuildResult::Slide(out_path) => self.display_status("Slide", &in_path, &out_path), + DockiBuildResult::Doc(out_path) => self.display_status("Doc", &in_path, &out_path) } } return Ok(()); } + + fn display_status(&self, status_type: &str, in_path: &str, out_path: &str) -> () { + println!( + "({} / {}) [{}] {} -> {}", + self.progress, self.goal, status_type, in_path, out_path + ); + } + } diff --git a/src/app/commands/serve.rs b/src/app/commands/serve.rs index b1475d5..cdff8f7 100644 --- a/src/app/commands/serve.rs +++ b/src/app/commands/serve.rs @@ -7,10 +7,7 @@ use notify::{ }; use std::{env, path::Path}; -use crate::app::{builder::{ - asciidoctor::{AsciiDoctorDocsBuilder, AsciiDoctorSlideBuilder}, - Builder, -}, watcher::watcher}; +use crate::app::{ watcher::watcher, build::docki_build}; pub async fn serve() { @@ -63,19 +60,11 @@ fn build_file(paths: Vec) -> Result<(), String> { .expect(invalid_path_message) .replace(¤t_dir(), "") .replace("/./", "./"); - let out_path = in_path - .replace("./docs/", "./dist/") - .replace(".adoc", ".html"); println!("{} {}", "[Rebuilding]".green(), in_path); - if in_path.starts_with("./docs/slides") { - let slide_builder = AsciiDoctorSlideBuilder {}; - slide_builder.build(&in_path, &out_path) - } else { - let doc_builder = AsciiDoctorDocsBuilder {}; - doc_builder.build(&in_path, &out_path) - } + docki_build(&in_path); + return Ok(()) } fn current_dir() -> String { diff --git a/src/app/fs_util/mod.rs b/src/app/fs_util/mod.rs index e01d58e..2c6799c 100644 --- a/src/app/fs_util/mod.rs +++ b/src/app/fs_util/mod.rs @@ -82,3 +82,4 @@ pub fn docki_path_env() -> String { let current = env::var("PATH").unwrap_or("".to_string()); return expand_path(format!("{}:~/.docki/", current)); } + diff --git a/src/app/mod.rs b/src/app/mod.rs index 2f01bea..b0c7416 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,5 +1,5 @@ mod commands; -pub mod builder; +pub mod build; pub mod fs_util; pub mod watcher; mod args; From dc02b86adf7d1ef01a2b8f6c060d3cc43a29299e Mon Sep 17 00:00:00 2001 From: quirinecker Date: Mon, 13 Mar 2023 00:21:56 +0100 Subject: [PATCH 14/21] improved the logging --- .../commands/executions/build_execution.rs | 18 +++++------ src/app/commands/serve.rs | 30 +++++++++++++------ src/app/log/mod.rs | 20 +++++++++++++ src/app/mod.rs | 1 + 4 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 src/app/log/mod.rs diff --git a/src/app/commands/executions/build_execution.rs b/src/app/commands/executions/build_execution.rs index f30cc92..f5fbaac 100644 --- a/src/app/commands/executions/build_execution.rs +++ b/src/app/commands/executions/build_execution.rs @@ -5,7 +5,7 @@ use std::{ use crate::app::{ build::{docki_build, DockiBuildResult}, - fs_util, + fs_util, log::display_status, }; pub struct BuildExecution { @@ -73,23 +73,21 @@ impl BuildExecution { match result { DockiBuildResult::Err(err) => { - self.display_status("Error", in_path, ""); + self.display_building_status("Error", in_path, ""); println!("{}", err) }, - DockiBuildResult::Copy(out_path) => self.display_status("Copy", &in_path, &out_path), - DockiBuildResult::Slide(out_path) => self.display_status("Slide", &in_path, &out_path), - DockiBuildResult::Doc(out_path) => self.display_status("Doc", &in_path, &out_path) + DockiBuildResult::Copy(out_path) => self.display_building_status("Copy", &in_path, &out_path), + DockiBuildResult::Slide(out_path) => self.display_building_status("Slide", &in_path, &out_path), + DockiBuildResult::Doc(out_path) => self.display_building_status("Doc", &in_path, &out_path) } } return Ok(()); } - fn display_status(&self, status_type: &str, in_path: &str, out_path: &str) -> () { - println!( - "({} / {}) [{}] {} -> {}", - self.progress, self.goal, status_type, in_path, out_path - ); + fn display_building_status(&self, status_type: &str, in_path: &str, out_path: &str) -> () { + let progress_str = format!("{} / {}", self.progress, self.goal); + display_status(&progress_str, status_type, in_path, out_path); } } diff --git a/src/app/commands/serve.rs b/src/app/commands/serve.rs index cdff8f7..3fdf0e9 100644 --- a/src/app/commands/serve.rs +++ b/src/app/commands/serve.rs @@ -5,12 +5,13 @@ use notify::{ event::ModifyKind, Event, EventKind, RecursiveMode, Watcher, }; -use std::{env, path::Path}; +use std::{env, path::Path, process::Output}; -use crate::app::{ watcher::watcher, build::docki_build}; +use crate::app::{ watcher::watcher, build::{docki_build, DockiBuildResult}, commands::build::build, log::display_status}; pub async fn serve() { + build().await; tokio::join!(watch_and_build(), start_server()); } @@ -21,7 +22,7 @@ async fn watch_and_build() { } async fn start_server() { - println!("Serving at http://localhost:8080"); + println!("\nServing at {} ", "http://localhost:8080".bold()); let Ok(()) = listen("localhost", 8080, "./dist").await else { panic!("could not start server") @@ -44,14 +45,13 @@ async fn watch(path: &Path) -> notify::Result<()> { fn file_change(event: Event) { match event.kind { EventKind::Modify(ModifyKind::Data(_)) => { - build_file(event.paths).expect("building file failed"); - () + build_file(event.paths) } _ => (), } } -fn build_file(paths: Vec) -> Result<(), String> { +fn build_file(paths: Vec) { let invalid_path_message = "changed path is invalid"; let in_path = paths .first() @@ -61,10 +61,22 @@ fn build_file(paths: Vec) -> Result<(), String> { .replace(¤t_dir(), "") .replace("/./", "./"); - println!("{} {}", "[Rebuilding]".green(), in_path); - docki_build(&in_path); - return Ok(()) + let result = docki_build(&in_path); + + match result { + DockiBuildResult::Slide(out_path) => display_rebuilding_status("Slide", &in_path, &out_path), + DockiBuildResult::Doc(out_path) => display_rebuilding_status("Doc", &in_path, &out_path), + DockiBuildResult::Copy(out_path) => display_rebuilding_status("Copy", &in_path, &out_path), + DockiBuildResult::Err(err) => { + display_rebuilding_status("Error", &in_path, ""); + println!("{}", err); + }, + } +} + +fn display_rebuilding_status(context: &str, in_path: &str, out_path: &str) { + display_status("Rebuildng", context, in_path, out_path) } fn current_dir() -> String { diff --git a/src/app/log/mod.rs b/src/app/log/mod.rs new file mode 100644 index 0000000..62ed2d2 --- /dev/null +++ b/src/app/log/mod.rs @@ -0,0 +1,20 @@ +use colored::Colorize; + +pub fn display_status(context1: &str, context2: &str, in_path: &str, out_path: &str) { + let colored_context = color_context(context2); + println!( + "({}) [{}] {} -> {}", + context1.bold(), + colored_context, + in_path, + out_path + ); +} + +fn color_context(context: &str) -> colored::ColoredString { + if context == "Error" { + return context.bright_red() + } else { + return context.bright_green() + } +} diff --git a/src/app/mod.rs b/src/app/mod.rs index b0c7416..91a321a 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -2,6 +2,7 @@ mod commands; pub mod build; pub mod fs_util; pub mod watcher; +pub mod log; mod args; use std::env; From da5046bfc034d76d71205da2aee935ce0c7a149c Mon Sep 17 00:00:00 2001 From: quirinecker Date: Mon, 13 Mar 2023 00:28:07 +0100 Subject: [PATCH 15/21] simplified match --- src/app/commands/serve.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/commands/serve.rs b/src/app/commands/serve.rs index 3fdf0e9..3b5bdff 100644 --- a/src/app/commands/serve.rs +++ b/src/app/commands/serve.rs @@ -5,7 +5,7 @@ use notify::{ event::ModifyKind, Event, EventKind, RecursiveMode, Watcher, }; -use std::{env, path::Path, process::Output}; +use std::{env, path::Path}; use crate::app::{ watcher::watcher, build::{docki_build, DockiBuildResult}, commands::build::build, log::display_status}; @@ -44,9 +44,7 @@ async fn watch(path: &Path) -> notify::Result<()> { fn file_change(event: Event) { match event.kind { - EventKind::Modify(ModifyKind::Data(_)) => { - build_file(event.paths) - } + EventKind::Modify(ModifyKind::Data(_)) => build_file(event.paths), _ => (), } } From 422046762500caa2809b85b23e4ab856ebf35de5 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Mon, 13 Mar 2023 00:35:31 +0100 Subject: [PATCH 16/21] added optional port as argument --- src/app/args/structure.rs | 6 +++++- src/app/commands/serve.rs | 8 ++++---- src/app/mod.rs | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app/args/structure.rs b/src/app/args/structure.rs index d2c4442..436676d 100644 --- a/src/app/args/structure.rs +++ b/src/app/args/structure.rs @@ -15,5 +15,9 @@ pub enum CommandArg { /// Helper command for installing asciidoctor-reveal-js InstallReveal, /// Starts a Webserver with the live preview of the Documentation - Serve + Serve { + /// Port for the Live Server + #[arg(short, long)] + port: Option + } } diff --git a/src/app/commands/serve.rs b/src/app/commands/serve.rs index 3b5bdff..8fac25c 100644 --- a/src/app/commands/serve.rs +++ b/src/app/commands/serve.rs @@ -10,9 +10,9 @@ use std::{env, path::Path}; use crate::app::{ watcher::watcher, build::{docki_build, DockiBuildResult}, commands::build::build, log::display_status}; -pub async fn serve() { +pub async fn serve(port: Option) { build().await; - tokio::join!(watch_and_build(), start_server()); + tokio::join!(watch_and_build(), start_server(port)); } async fn watch_and_build() { @@ -21,10 +21,10 @@ async fn watch_and_build() { .expect("something went wrong") } -async fn start_server() { +async fn start_server(port: Option) { println!("\nServing at {} ", "http://localhost:8080".bold()); - let Ok(()) = listen("localhost", 8080, "./dist").await else { + let Ok(()) = listen("localhost", port.unwrap_or(8080), "./dist").await else { panic!("could not start server") }; } diff --git a/src/app/mod.rs b/src/app/mod.rs index 91a321a..15749d1 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -25,7 +25,7 @@ impl App { CommandArg::Build => build().await, CommandArg::Health => health(), CommandArg::InstallReveal => install_reveal().await, - CommandArg::Serve => serve().await + CommandArg::Serve { port } => serve(port).await }; } From ad10d61697cd852ee88963b4c2bc2911af78d4e9 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Mon, 13 Mar 2023 01:18:26 +0100 Subject: [PATCH 17/21] fixed permission for the reveal install script --- src/app/commands/install_reveal.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/commands/install_reveal.rs b/src/app/commands/install_reveal.rs index 01569d0..149af37 100644 --- a/src/app/commands/install_reveal.rs +++ b/src/app/commands/install_reveal.rs @@ -1,14 +1,14 @@ -use std::{fs::File, io::Write}; +use std::{fs::{File, Permissions}, io::Write, os::unix::prelude::PermissionsExt}; use crate::app::fs_util; const ASCIIDOC_REVEAL_VERSION: &str= "v4.1.0-rc.5"; pub async fn install_reveal() -> () { - let result = reqwest::blocking::get(url()) + let result = reqwest::get(url()).await .expect("Could not download reveal. Make sure you are connected to the internet"); - let binary = result.bytes().expect("could not get binary"); + let binary = result.bytes().await.expect("could not get binary"); let home_path = home::home_dir().expect("could not find home dir"); let save_path = format!("{}/.docki/asciidoctor-revealjs", home_path.display()); @@ -17,6 +17,7 @@ pub async fn install_reveal() -> () { fs_util::create_dir_recursive(save_dir.as_str()); let mut file = File::create(save_path).expect("could not save binary"); + file.set_permissions(Permissions::from_mode(0o770)).expect("could not set permission"); file.write_all(&binary).expect("could not save binary"); } From 12846726ebbb05c68936f2c9bbeae33a638656e9 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Mon, 13 Mar 2023 01:32:31 +0100 Subject: [PATCH 18/21] made function for creating parent directory --- src/app/build/mod.rs | 4 +--- src/app/fs_util/mod.rs | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/build/mod.rs b/src/app/build/mod.rs index 5ff595a..1950547 100644 --- a/src/app/build/mod.rs +++ b/src/app/build/mod.rs @@ -36,9 +36,7 @@ pub fn docki_build(in_path: &str) -> DockiBuildResult { } fn copy(in_path: &str, out_path: &str) -> Result<(), String> { - let segments: &Vec<&str> = &out_path.split("/").collect(); - let parent_dir = &segments[0..segments.len() - 1].join("/"); - fs_util::create_dir_recursive(parent_dir); + fs_util::create_parent_dir_recursive(out_path); if let Err(err) = fs::copy(in_path, out_path) { return Err(err.to_string()) diff --git a/src/app/fs_util/mod.rs b/src/app/fs_util/mod.rs index 2c6799c..5ba6c49 100644 --- a/src/app/fs_util/mod.rs +++ b/src/app/fs_util/mod.rs @@ -83,3 +83,9 @@ pub fn docki_path_env() -> String { return expand_path(format!("{}:~/.docki/", current)); } +pub fn create_parent_dir_recursive(out_path: &str) -> () { + let segments: &Vec<&str> = &out_path.split("/").collect(); + let parent_dir = &segments[0..segments.len() - 1].join("/"); + create_dir_recursive(parent_dir); +} + From 4cc8addb72d6159ff3c1dbe1dcce51cfcbb630f5 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Mon, 13 Mar 2023 01:32:56 +0100 Subject: [PATCH 19/21] creating required slides directory when preapring for build --- src/app/commands/executions/build_execution.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/commands/executions/build_execution.rs b/src/app/commands/executions/build_execution.rs index f5fbaac..818c30d 100644 --- a/src/app/commands/executions/build_execution.rs +++ b/src/app/commands/executions/build_execution.rs @@ -5,7 +5,7 @@ use std::{ use crate::app::{ build::{docki_build, DockiBuildResult}, - fs_util, log::display_status, + fs_util::{self, create_dir_recursive}, log::display_status, }; pub struct BuildExecution { @@ -42,6 +42,8 @@ impl BuildExecution { let reveal_version = "3.9.2"; let target = format!("https://github.com/hakimel/reveal.js/archive/{reveal_version}.zip"); + create_dir_recursive("./docs/slides"); + let Ok(response) = reqwest::get(target).await else { return Err("could not downlaod revealjs".to_string()) }; From bdfa89dee40a461607afe63e63eead43907079ef Mon Sep 17 00:00:00 2001 From: quirinecker Date: Mon, 13 Mar 2023 01:44:58 +0100 Subject: [PATCH 20/21] fixed test erro --- src/test/{builder => build}/asciidoctor.rs | 2 +- src/test/{builder => build}/mod.rs | 0 src/test/mod.rs | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename src/test/{builder => build}/asciidoctor.rs (96%) rename src/test/{builder => build}/mod.rs (100%) diff --git a/src/test/builder/asciidoctor.rs b/src/test/build/asciidoctor.rs similarity index 96% rename from src/test/builder/asciidoctor.rs rename to src/test/build/asciidoctor.rs index 883152e..473efe6 100644 --- a/src/test/builder/asciidoctor.rs +++ b/src/test/build/asciidoctor.rs @@ -1,4 +1,4 @@ -use crate::app::builder::asciidoctor; +use crate::app::build::asciidoctor; #[test] fn last_matching_index_0() { diff --git a/src/test/builder/mod.rs b/src/test/build/mod.rs similarity index 100% rename from src/test/builder/mod.rs rename to src/test/build/mod.rs diff --git a/src/test/mod.rs b/src/test/mod.rs index f39763a..71a213f 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -1,2 +1,2 @@ mod fs_util; -mod builder; +mod build; From beeaa782caa04d2935689e036730cc38521156d4 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Mon, 13 Mar 2023 01:47:52 +0100 Subject: [PATCH 21/21] incremented the version 1.0.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index acffad0..61be061 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "docki" -version = "0.3.0" +version = "1.0.0" edition = "2021" description = "cli for building and publishing documentation using asciidoctor" license-file = "LICENSE.txt"