Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

Commit

Permalink
Added installer to drupal pre commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
tobybatch committed Nov 22, 2016
1 parent 528cc43 commit 25217e3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions drupal-pre-commit-hook
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
#!/bin/bash

if [ "$1" == '--install' ]; then
mkdir -p $HOME/.neontabs
logfile=$HOME/.neontabs/$(basename $0).$(date +"%y-%m-%d_%H-%M").log
filelist="$(locate .git/config)"
this="$(realpath $0)"
for repo in $filelist; do
dotgit="$(dirname $repo)"
repo_root="$(dirname $dotgit)"
precommithook=$repo_root/.git/hooks/pre-commit
# Is this a drupal enabled repo
if [ -e $repo_root/.drupal_repo ]; then
# Does the precommit hook exist
if [ ! -e $precommithook ]; then
ln -s $this $precommithook
msg="drupal enabled, adding hook to: $repo_root"
echo $msg >> $logfile
echo $msg
else
echo "pre-commit hook exists, skipping: $precommithook" >> $logfile
fi
else
echo "not a drupal repo, skipping: $repo_root" >> $logfile
fi
done
exit
fi

ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
Expand Down

0 comments on commit 25217e3

Please sign in to comment.