#!/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/src/Standards/Security"

# Add git hooks to auto-format and validate code
echo Installing git hooks...
find "$CWD/git/" -type f -exec chmod +x "{}" \; -exec cp "{}" "$BASEDIR/.git/hooks/" \;
