2019-04-18 18:38:20 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# this has to run once atfer git clone
|
|
|
|
# and every time we create new hooks
|
2019-05-02 12:33:10 +02:00
|
|
|
#### $$VERSION$$ v0.80-dev-2-g4e4194d
|
2019-04-18 18:38:20 +02:00
|
|
|
|
2019-04-18 18:42:42 +02:00
|
|
|
# magic to ensure that we're always inside the root of our application,
|
2019-04-18 18:38:20 +02:00
|
|
|
# no matter from which directory we'll run script
|
|
|
|
GIT_DIR=$(git rev-parse --git-dir)
|
2019-04-18 18:42:42 +02:00
|
|
|
cd "$GIT_DIR/.." || exit 1
|
2019-04-18 18:38:20 +02:00
|
|
|
|
2019-04-19 10:43:06 +02:00
|
|
|
HOOKDIR="dev/hooks"
|
|
|
|
|
2019-04-18 18:38:20 +02:00
|
|
|
echo -n "Installing hooks..."
|
|
|
|
for hook in pre-commit pre-push
|
|
|
|
do
|
2019-04-19 13:01:25 +02:00
|
|
|
rm -f "${GIT_DIR}/hooks/${hook}"
|
2019-04-19 10:43:06 +02:00
|
|
|
if [ -f "${HOOKDIR}/${hook}.sh" ]; then
|
2019-04-18 18:38:20 +02:00
|
|
|
echo -n " $hook"
|
2019-04-19 10:43:06 +02:00
|
|
|
ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}"
|
2019-04-18 18:38:20 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo " Done!"
|