#!/bin/sh
#
# Composer post-install script to install the git pre-commit hook
#
# @author      Steve Talbot
# @copyright   Copyright (c) Solviq Ltd 2016-7
# @license     MIT

# Work out the base directory of the project/module
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASEDIR="${CWD%/*}"

# Symlink additional rules for PHP CodeSniffer
ln -f -s "$BASEDIR/vendor/pheromone/phpcs-security-audit/Security" "$BASEDIR/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Security"

# Add git pre-commit hook to auto-format code
echo Installing git pre-commit hook...
cp "$CWD/git-pre-commit" "$BASEDIR/.git/hooks/pre-commit"
chmod +x .git/hooks/pre-commit
