Skip to content

Commit

Permalink
Add an initial wrapper script for phpmetrics package.
Browse files Browse the repository at this point in the history
Usage: `bin/metrics-generate`.
  • Loading branch information
beporter committed Apr 12, 2016
1 parent 208c271 commit 29f5d65
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"git-localchanges",
"git-remotechanges",
"logs-clear",
"metrics-generate",
"migrations",
"nfsexports-setsudoaccess",
"owner-set",
Expand Down
45 changes: 45 additions & 0 deletions metrics-generate
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

#---------------------------------------------------------------------
usage ()
{
cat <<EOT
${0##*/}
Wraps up the call to the PHPMetrics library for standard Cake
project folder layouts. Writes reports into the tmp/metrics/
folder.
Should be run from the project root folder.
Usage:
bin/${0##*/}
EOT

exit ${1:-0} # Exit with code 0 unless an arg is passed to the method.
}
if [ "$1" = '-h' ]; then
usage
fi


# Set up local variables.
umask a+rw

DIR="$( cd -P "$( dirname "$0" )"/.. >/dev/null 2>&1 && pwd )"
TMP_DIR="tmp"
REPORT_DIR="${TMP_DIR}/metrics"
REPORT_FILE="${REPORT_DIR}/index.html"
TARGET_FOLDERS=("./src")

if [ $# -gt 0 ]; then
TARGET_FOLDERS=("$@")
fi


echo "## Generating metrics report.";
bin/phpmetrics \
--report-html="$REPORT_FILE" \
${TARGET_FOLDERS[@]}

0 comments on commit 29f5d65

Please sign in to comment.