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.
62 lines
1.4 KiB
62 lines
1.4 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
|
|
rv=$?
|
|
if [[ $rv > 0 ]]; then
|
|
composer dumpautoload -v
|
|
fi
|
|
return $rv
|
|
}
|
|
|
|
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
|
|
exit $?
|
|
elif [[ $cmd == "test" ]]; then
|
|
if [[ ! -d "vendor/" ]]; then
|
|
update
|
|
if [[ $? -ne 0 ]]; then
|
|
exit $?
|
|
fi
|
|
fi
|
|
./vendor/bin/phpunit --testdox --stderr tests
|
|
exit $?
|
|
elif [[ $cmd == "tidy" ]]; then
|
|
tidy
|
|
elif [[ $cmd == "clean" ]]; then
|
|
tidy && clean
|
|
else
|
|
echo "Unrecognized verb: ${cmd}"
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|