Skip to content

Instantly share code, notes, and snippets.

@sukovec
Last active February 13, 2018 22:42
Show Gist options
  • Save sukovec/34261feb7838f7c6489830466ff0af38 to your computer and use it in GitHub Desktop.
Save sukovec/34261feb7838f7c6489830466ff0af38 to your computer and use it in GitHub Desktop.
#!/bin/bash
export XDEBUG_REMOTE_HOST=""
export DOCO=$(which docker-compose)
function docker-compose() {
if [ -z ${GIT_DIR+X} ] ; then
$DOCO "$@"
return $?
fi
if [ "$1" == "exec" ] ; then
shift
$DOCO exec -T "$@"
fi
}
function set() {
if [ "$1" == "-exuo" -a "$2" == "pipefail" ] ; then
builtin set -euo pipefail
else
builtin set "$@"
fi
}
export -f set
export -f docker-compose
function run_check() {
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TMP=$(mktemp)
if ${DIR}/${1} > $TMP ; then
echo -e "\033[32m${2} passed\033[0m"
rm $TMP
return 0
else
RETV=$?
echo -e "\033[31m${2} failed\033[0m"
echo "== ${1} output: =="
cat $TMP
echo "== end of output =="
rm $TMP
exit $RETV
fi
}
run_check cs-checker.sh "Code style checks"
run_check phpstan.sh "Static analysis"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment