From 69ea4105bfea00feb464a7504a7fd7e574c54af1 Mon Sep 17 00:00:00 2001 From: Toby Batch Date: Tue, 22 Nov 2016 06:26:41 +0000 Subject: [PATCH] Added installer for phpcs to the drupal pre commit --- drupal-pre-commit-hook | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drupal-pre-commit-hook b/drupal-pre-commit-hook index 4430e3b..2a22e69 100755 --- a/drupal-pre-commit-hook +++ b/drupal-pre-commit-hook @@ -1,6 +1,17 @@ #!/bin/bash if [ "$1" == '--install' ]; then + which phpcs + if [ "$?" != 0 ]; then + composer global require squizlabs/php_codesniffer + composer global require drupal/coder + composer global require graphp/graphviz + + echo "export PATH=$PATH:$HOME/.composer/vendor/bin/" >> ~/.bashrc + $HOME/.composer/vendor/bin/phpcs --config-set installed_paths $HOME/.composer/vendor/drupal/coder/coder_sniffer + source ~/.bashrc + fi + mkdir -p $HOME/.neontabs logfile=$HOME/.neontabs/$(basename $0).$(date +"%y-%m-%d_%H-%M").log filelist="$(locate .git/config)"