diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b705a1..f82f279 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.11.0 + +* move tmpFolder into local Project to avoid conflicts with limited space in /tmp folder + ## 0.10.2 * move to tempfile from deprecated tempdir @@ -133,4 +137,4 @@ ## 0.1.0 -* initial release \ No newline at end of file +* initial release diff --git a/Cargo.lock b/Cargo.lock index 9884635..c3ef597 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,8 +106,8 @@ dependencies = [ "clap_complete", "color-eyre", "console", - "copy_dir", "ctrlc", + "dircpy", "fuzzy-matcher", "itertools", "semver", @@ -244,15 +244,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "copy_dir" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "543d1dd138ef086e2ff05e3a48cf9da045da2033d16f8538fd76b86cd49b2ca3" -dependencies = [ - "walkdir", -] - [[package]] name = "ctrlc" version = "3.5.0" @@ -264,6 +255,16 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "dircpy" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a88521b0517f5f9d51d11925d8ab4523497dcf947073fa3231a311b63941131c" +dependencies = [ + "log", + "walkdir", +] + [[package]] name = "dispatch" version = "0.2.0" @@ -396,6 +397,12 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + [[package]] name = "memchr" version = "2.7.6" diff --git a/Cargo.toml b/Cargo.toml index b66ea8e..63f1607 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ itertools = { version = "0.14.0", default-features = false, features = ["use_all semver = { version = "1.0.25", default-features = false } toml_edit = "0.23.7" tempfile = { version = "3.20.0", default-features = false } -copy_dir = "0.1.3" +dircpy = { version = "0.3.19", default-features = false } [[bin]] name = "cargo-features" diff --git a/src/prune/display.rs b/src/prune/display.rs index 1709677..8b725fe 100644 --- a/src/prune/display.rs +++ b/src/prune/display.rs @@ -53,6 +53,10 @@ impl Display { } pub fn start(&self) -> Result<()> { + // clear for "Creating temporary project..." text + self.term.move_cursor_up(1)?; + self.term.clear_line()?; + writeln!(&self.term, "workspace [{}]", self.feature_count)?; self.term.hide_cursor()?; Ok(()) diff --git a/src/prune/mod.rs b/src/prune/mod.rs index 9877909..74c00f8 100644 --- a/src/prune/mod.rs +++ b/src/prune/mod.rs @@ -6,12 +6,14 @@ use crate::prune::display::Display; use crate::prune::parse::get_features_to_test; use color_eyre::Result; use color_eyre::eyre::{ContextCompat, eyre}; -use copy_dir::copy_dir; +use dircpy::{CopyBuilder, copy_dir}; use itertools::Itertools; use std::collections::HashMap; use std::ops::Not; use std::path::Path; use std::process::{Command, Stdio}; +use std::thread; +use std::time::Duration; use tempfile::TempDir; mod parse; @@ -27,13 +29,19 @@ pub fn prune(is_dry_run: bool, skip_tests: bool, clean: CleanLevel, no_tmp: bool let mut main_document = Document::new(".")?; //needed to be set here so the temp_dir lives long enough - let tmp_dir = TempDir::with_suffix("cargo-features-manager")?; + let tmp_dir = TempDir::with_prefix_in(".cargo-features-manager-", ".")?; let mut document = if no_tmp { Document::new(".")? } else { - let project_path = tmp_dir.path().join("project"); - copy_dir(main_document.root_path(), &project_path)?; + println!("Creating temporary project..."); + let project_path = tmp_dir.path(); + + CopyBuilder::new(main_document.root_path(), project_path) + .with_exclude_filter(project_path.to_str().unwrap()) + .run()?; + + thread::sleep(Duration::from_millis(1000)); match Document::new(project_path) { Ok(document) => {document}