Last active
December 15, 2015 21:59
-
-
Save robertbasic/5329789 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
MODULE_DIR="module" | |
TEST_DIR="/test" | |
DOCS_DIR="/docs" | |
COVERAGE_DIR=$PWD"/docs/coverage/" | |
COVERAGE_INDEX=$COVERAGE_DIR$MODULE_DIR"/index.html" | |
BOOTSTRAP_FILE="Bootstrap.php" | |
PHPUNIT_FILE="phpunit.xml" | |
function create_coverage_index() { | |
local LINK="<a href='$1'>$1</a><br>" | |
echo $LINK >> $COVERAGE_INDEX | |
} | |
if [ -f $COVERAGE_INDEX ] | |
then | |
cat "" > $COVERAGE_INDEX | |
fi | |
for dir in $(find $MODULE_DIR -mindepth 1 -maxdepth 1 -type d); | |
do | |
MODULE_TEST_DIR=$dir$TEST_DIR"/" | |
MODULE_NAME=$( echo "$dir" | cut -c8- ) | |
if [ -d $MODULE_TEST_DIR ] | |
then | |
if [ -f $MODULE_TEST_DIR$BOOTSTRAP_FILE ] \ | |
&& [ -f $MODULE_TEST_DIR$PHPUNIT_FILE ] | |
then | |
if [ -d $PWD$DOCS_DIR ] | |
then | |
REPORT_DIR=$COVERAGE_DIR$dir | |
/usr/bin/env phpunit --coverage-html $REPORT_DIR --bootstrap $MODULE_TEST_DIR$BOOTSTRAP_FILE | |
create_coverage_index $MODULE_NAME | |
else | |
/usr/bin/env phpunit --bootstrap $MODULE_TEST_DIR$BOOTSTRAP_FILE | |
fi | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment