Refactored test setup code
Removed the copy/paste code, moved it into a reusable function that can be called from the `local_setup` function as needed. Also simplified the handling of the $HOME variable since @rico-chet provided a better way of doing this.
This commit is contained in:
@@ -6,21 +6,7 @@ load ../../lib/composure
|
||||
load ../../plugins/available/ruby.plugin
|
||||
|
||||
function local_setup {
|
||||
mkdir -p "$BASH_IT"
|
||||
lib_directory="$(cd "$(dirname "$0")" && pwd)"
|
||||
# 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 --exclude=enabled $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
|
||||
|
||||
mkdir -p "$BASH_IT"/enabled
|
||||
mkdir -p "$BASH_IT"/aliases/enabled
|
||||
mkdir -p "$BASH_IT"/completion/enabled
|
||||
mkdir -p "$BASH_IT"/plugins/enabled
|
||||
setup_test_fixture
|
||||
|
||||
export OLD_PATH="$PATH"
|
||||
export PATH="/usr/bin:/bin:/usr/sbin"
|
||||
|
||||
Reference in New Issue
Block a user