From 1dd54c478e35f22e4ba7fd1e0d46c100ecd64b62 Mon Sep 17 00:00:00 2001 From: dustinblackman Date: Fri, 5 Jul 2024 09:10:59 -0400 Subject: [PATCH] chore: Drop owo --- .cargo/config.toml | 3 +++ Cargo.lock | 7 ------- Cargo.toml | 11 +++++------ src/cli.rs | 5 ++--- src/main.rs | 4 +--- tests/cargo_config_test.rs | 13 +------------ tests/cli_integration_test.rs | 32 ++++++++++++++++---------------- 7 files changed, 28 insertions(+), 47 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 2422f3b..7f3455e 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -9,3 +9,6 @@ watch = ["bin", "cargo-watch"] [env] BINSTALL_STRATEGIES = "crate-meta-data,compile" + +[net] +git-fetch-with-cli = true diff --git a/Cargo.lock b/Cargo.lock index 9fb0f36..aee50dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -105,7 +105,6 @@ dependencies = [ "cfg-if", "clap", "insta", - "owo-colors", "rustversion", "serde", "toml", @@ -297,12 +296,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "owo-colors" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" - [[package]] name = "predicates" version = "3.0.4" diff --git a/Cargo.toml b/Cargo.toml index 39f6cf1..a6beb09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,13 +19,12 @@ required-features = ["cli"] [features] default = ["cli"] -cli = ["dep:clap", "dep:owo-colors"] +cli = ["dep:clap"] [dependencies] anyhow = "1.0.40" cfg-if = "1.0.0" clap = { version = "4.3.19", optional = true } -owo-colors = { version = "3.5.0", optional = true } rustversion = "1.0.14" serde = { version = "1.0.149", features = ["derive"] } toml = "0.5.9" @@ -120,23 +119,23 @@ release = '''set -e test-coverage = '''set -e rm -rf .tmp cargo build - cargo llvm-cov nextest --ignore-filename-regex='_test.rs' + cargo llvm-cov nextest -j 1 --ignore-filename-regex='_test.rs' ''' test-coverage-html = '''set -e rm -rf .tmp cargo build - cargo llvm-cov nextest --open --ignore-filename-regex='_test.rs' + cargo llvm-cov nextest -j 1 --open --ignore-filename-regex='_test.rs' ''' test-coverage-lcov = '''set -e rm -rf .tmp cargo build rm -f lcov.info - cargo llvm-cov nextest --lcov --output-path lcov.info --ignore-filename-regex='_test.rs' + cargo llvm-cov nextest -j 1 --lcov --output-path lcov.info --ignore-filename-regex='_test.rs' ''' test = '''set -e rm -rf .tmp cargo build - cargo nextest run + cargo nextest run -j 1 ''' test-watch = '''set -e cargo watch -i .cargo -x 'cmd test' diff --git a/src/cli.rs b/src/cli.rs index 4603a07..8718990 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -5,7 +5,6 @@ use anyhow::Result; use clap::Arg; use clap::ArgMatches; use clap::Command; -use owo_colors::OwoColorize; use crate::binary; use crate::cargo_config; @@ -18,13 +17,13 @@ fn install_all_binaries() -> Result<()> { binary::install(binary_package)?; } - println!("{}", "Done!".green()); + println!("\x1b[32m{}\x1b[0m", "Done!"); return Ok(()); } fn sync_aliases() -> Result<()> { cargo_config::sync_aliases()?; - println!("{}", "Done!".green()); + println!("\x1b[32m{}\x1b[0m", "Done!"); return Ok(()); } diff --git a/src/main.rs b/src/main.rs index 4b86cf0..640466c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,12 @@ use std::process; -use owo_colors::OwoColorize; - fn main() { let res = cargo_run_bin::cli::run(); // Only reached if run-bin code fails, otherwise process exits early from within // binary::run. if let Err(res) = res { - eprintln!("{}", format!("run-bin failed: {res}").red()); + eprintln!("\x1b[31m{}\x1b[0m", format!("run-bin failed: {res}")); process::exit(1); } } diff --git a/tests/cargo_config_test.rs b/tests/cargo_config_test.rs index ba010a7..f027588 100644 --- a/tests/cargo_config_test.rs +++ b/tests/cargo_config_test.rs @@ -14,15 +14,4 @@ mod sync_aliases { assert!(res.is_ok()); assert!(toml_str.contains("nextest = [\"bin\", \"cargo-nextest\"]")); } -} - -mod binstall_alias_exists { - use cargo_run_bin::cargo_config::binstall_alias_exists; - - // Lazy happy path test. - #[test] - fn it_should_return_true() { - let res = binstall_alias_exists().unwrap(); - assert!(res); - } -} +} \ No newline at end of file diff --git a/tests/cli_integration_test.rs b/tests/cli_integration_test.rs index 31fc43c..41b63dc 100644 --- a/tests/cli_integration_test.rs +++ b/tests/cli_integration_test.rs @@ -9,8 +9,8 @@ mod direct { let res = assert.success(); let stdout = String::from_utf8(res.get_output().stdout.clone()).unwrap(); insta::assert_snapshot!(stdout, @r###" - Done! - "###); + Done! + "###); } #[test] @@ -21,8 +21,8 @@ mod direct { let res = assert.success(); let stdout = String::from_utf8(res.get_output().stdout.clone()).unwrap(); insta::assert_snapshot!(stdout, @r###" - Done! - "###); + Done! + "###); } #[test] @@ -33,8 +33,8 @@ mod direct { let res = assert.success(); let stdout = String::from_utf8(res.get_output().stdout.clone()).unwrap(); insta::assert_snapshot!(stdout, @r###" - Done! - "###); + Done! + "###); } #[test] @@ -65,8 +65,8 @@ mod direct { let res = assert.failure(); let stderr = String::from_utf8(res.get_output().stderr.clone()).unwrap(); insta::assert_snapshot!(stderr, @r###" - run-bin failed: No package found for binary not-real - "###); + run-bin failed: No package found for binary not-real + "###); } } @@ -81,8 +81,8 @@ mod bin_prefix { let res = assert.success(); let stdout = String::from_utf8(res.get_output().stdout.clone()).unwrap(); insta::assert_snapshot!(stdout, @r###" - Done! - "###); + Done! + "###); } #[test] @@ -93,8 +93,8 @@ mod bin_prefix { let res = assert.success(); let stdout = String::from_utf8(res.get_output().stdout.clone()).unwrap(); insta::assert_snapshot!(stdout, @r###" - Done! - "###); + Done! + "###); } #[test] @@ -105,8 +105,8 @@ mod bin_prefix { let res = assert.success(); let stdout = String::from_utf8(res.get_output().stdout.clone()).unwrap(); insta::assert_snapshot!(stdout, @r###" - Done! - "###); + Done! + "###); } #[test] @@ -137,7 +137,7 @@ mod bin_prefix { let res = assert.failure(); let stderr = String::from_utf8(res.get_output().stderr.clone()).unwrap(); insta::assert_snapshot!(stderr, @r###" - run-bin failed: No package found for binary not-real - "###); + run-bin failed: No package found for binary not-real + "###); } }