From 956152e44e3a2b004f0d7f45c3351ed3db0fdc8a Mon Sep 17 00:00:00 2001 From: Paul Delafosse Date: Sun, 13 Sep 2020 11:42:33 +0200 Subject: [PATCH] chore: fix lints --- src/hook.rs | 57 ----------------------------------------------------- src/lib.rs | 1 - 2 files changed, 58 deletions(-) delete mode 100644 src/hook.rs diff --git a/src/hook.rs b/src/hook.rs deleted file mode 100644 index 77265f76..00000000 --- a/src/hook.rs +++ /dev/null @@ -1,57 +0,0 @@ -use anyhow::Result; -use colored::*; -use std::process::{Command, Stdio}; - -#[derive(Debug, Deserialize, Serialize, Clone)] -pub struct Hook { - pub command: String, -} - -// TODO -impl Hook { - pub(crate) fn run(&self) -> Result<()> { - let command_display = format!("`{}`", &self.command.green()); - println!("Running pre-version hook : {}", command_display); - - Command::new(self.command.clone()) - .stdout(Stdio::inherit()) - .stderr(Stdio::inherit()) - .stdin(Stdio::inherit()) - .output() - .map_err(|err| anyhow!(err)) - .map(|_| ()) - } -} - -#[cfg(test)] -mod tests { - use crate::hook::Hook; - - #[test] - fn should_run_command() { - // Arrange - let hook = Hook { - command: "echo hello world".to_string(), - }; - - // Act - let result = hook.run(); - - // Assert - assert!(result.is_ok()); - } - - #[test] - fn should_fail_to_run_invalid_command() { - // Arrange - let hook = Hook { - command: "azmroih".to_string(), - }; - - // Act - let result = hook.run(); - - // Assert - assert!(result.is_err()); - } -} diff --git a/src/lib.rs b/src/lib.rs index 1e913115..9a01c61a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,7 +9,6 @@ extern crate lazy_static; pub mod changelog; pub mod error; pub mod filter; -mod hook; pub mod commit; pub mod repository;