From 2a16a5cd68195809e9d76588c2a5074805a18167 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Fri, 15 Sep 2017 08:10:15 +0200 Subject: [PATCH] Change install setup to use rsync instead of cp --- test/install/install.bats | 12 +++++++++--- test/install/uninstall.bats | 11 +++++++++-- test/lib/search.bats | 11 +++++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/test/install/install.bats b/test/install/install.bats index ded2689a..dc560760 100644 --- a/test/install/install.bats +++ b/test/install/install.bats @@ -14,10 +14,16 @@ case $OSTYPE in esac function local_setup { - mkdir -p $BASH_IT + mkdir -p "$BASH_IT" lib_directory="$(cd "$(dirname "$0")" && pwd)" - cp -r $lib_directory/../../* $BASH_IT/ - rm -rf "$BASH_IT/aliases/enabled" "$BASH_IT/completion/enabled" "$BASH_IT/plugins/enabled" + # Use rsync to copy Bash-it to the temp folder + # rsync is faster than cp, since we can exclude the large ".git" folder + rsync -qavrKL -d --delete-excluded --exclude=.git $lib_directory/../.. "$BASH_IT" + + rm -rf "$BASH_IT"/enabled + rm -rf "$BASH_IT"/aliases/enabled + rm -rf "$BASH_IT"/completion/enabled + rm -rf "$BASH_IT"/plugins/enabled # Don't pollute the user's actual $HOME directory # Use a test home directory instead diff --git a/test/install/uninstall.bats b/test/install/uninstall.bats index adab216f..6c7ae561 100644 --- a/test/install/uninstall.bats +++ b/test/install/uninstall.bats @@ -14,9 +14,16 @@ case $OSTYPE in esac function local_setup { - mkdir -p $BASH_IT + mkdir -p "$BASH_IT" lib_directory="$(cd "$(dirname "$0")" && pwd)" - cp -r $lib_directory/../../* $BASH_IT/ + # Use rsync to copy Bash-it to the temp folder + # rsync is faster than cp, since we can exclude the large ".git" folder + rsync -qavrKL -d --delete-excluded --exclude=.git $lib_directory/../.. "$BASH_IT" + + rm -rf "$BASH_IT"/enabled + rm -rf "$BASH_IT"/aliases/enabled + rm -rf "$BASH_IT"/completion/enabled + rm -rf "$BASH_IT"/plugins/enabled # Don't pollute the user's actual $HOME directory # Use a test home directory instead diff --git a/test/lib/search.bats b/test/lib/search.bats index 71a176d4..28b25d25 100644 --- a/test/lib/search.bats +++ b/test/lib/search.bats @@ -13,9 +13,16 @@ load ../../lib/search NO_COLOR=true function local_setup { - mkdir -p $BASH_IT + mkdir -p "$BASH_IT" lib_directory="$(cd "$(dirname "$0")" && pwd)" - cp -r $lib_directory/../../* $BASH_IT/ + # Use rsync to copy Bash-it to the temp folder + # rsync is faster than cp, since we can exclude the large ".git" folder + rsync -qavrKL -d --delete-excluded --exclude=.git $lib_directory/../.. "$BASH_IT" + + rm -rf "$BASH_IT"/enabled + rm -rf "$BASH_IT"/aliases/enabled + rm -rf "$BASH_IT"/completion/enabled + rm -rf "$BASH_IT"/plugins/enabled } @test "helpers search plugins" {