#!/bin/bash

set -e

[[ -n "${DISABLE_GIT_HOOKS}" ]] && {
    echo "[warn] the Git hooks are disabled by user."
    exit 0
}

BRANCH="$(git symbolic-ref --short HEAD)"
[[ "${BRANCH:-}" = wip-* ]] && {
    echo "[info] The current branch is working in progress."
    exit 0
}

if rake --version >/dev/null 2>&1; then
    rake test
else
    echo "[warn] the command 'rake' is not installed."
fi
