You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

#!/bin/bash
function tidy {
rm -vf {./,tests/,src/{./,AntiCSRF/,Clock/,Hash/,Request/,Required/,RFC/,Session/,URI/,Workflow/}}*~
rm -vf {./,tests/,src/{./,AntiCSRF/,Clock/,Hash/,Request/,Required/,RFC/,Session/,URI/,Workflow/}}#*#
}
function clean {
if [[ ! -d "vendor/" ]]; then
echo "No vendor/ folder to remove."
else
echo "Removing ./vendor/ ..."
rm -rf "vendor/"
echo "Done"
fi
rm -fv "composer.lock"
}
function update {
composer update
composer dumpautoload -v
}
if [[ $# -ne 1 ]]; then
echo "This script requires a verb."
echo "VERBS:"
echo " update - Update dependencies with composer"
echo " test - If no vendor/ folder Update, then run phpunit tests."
echo " clean - Remove all buildfiles and editor artifacts."
echo " tidy - Remove all editor artifacts."
echo ""
echo "For style points, you might consider targeting these with git-hooks"
fi
cmd=$1
if [[ $cmd == "update" ]]; then
update
elif [[ $cmd == "test" ]]; then
if [[ ! -d "vendor/" ]]; then
update
fi
./vendor/bin/phpunit --testdox tests
elif [[ $cmd == "tidy" ]]; then
tidy
elif [[ $cmd == "clean" ]]; then
tidy && clean
else
echo "Unrecognized verb: ${cmd}"
fi