Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Stop on error
- set -e
- # Move to base directory
- pushd "$(git rev-parse --show-toplevel)" > /dev/null
- # Clean any directory only containing phpunit.xml
- # sure it was created for another branch and does
- # not exist in current one.
- candidates=$(find . -name phpunit.xml -not -path "./vendor/*" | xargs dirname | sort -r)
- for candidate in ${candidates}; do
- numfiles=$(ls -1 ${candidate} | wc -l)
- if [[ ${ "Deleting empty ${candidate}"
- rm -fr ${candidate}
- # if that leads to an empty parent, delete it too
- parent=$(dirname ${candidate})
- numfiles=$(ls -1 ${parent} | wc -l)
- if [[ ${numfiles} -eq 0 ]]; then
- echo "Deleting empty ${parent}"
- rm -fr ${parent}
- fi
- fi
- done
- drop=
- # First, look for the (d)rop option
- if [[ -n ${1} ]]; then
- if [[ "${1}" == "d" ]] || [[ "${1}" == "drop" ]]; then
- drop=1
- fi
- fi
- if [[ -n ${drop} ]]; then
- php admin/tool/phpunit/cli/util.php --drop
- else
- php admin/tool/phpunit/cli/init.php
- fi
- php admin/tool/phpunit/cli/util.php --buildcomponentconfigs
- # Move back to original directory
- popd > /dev/null
Advertisement
Add Comment
Please, Sign In to add comment