2009-11-05T19:41:16+01:00

2. a hook for you

hook.jpg

Em, I mean a commit hook. What can such a thing do for you? Let's see by example. There are two usages for ba.pm.org.

1st to send out colourful notification email when someone do a commit to all interested parties.

2nd when the commit is made to the place where the final page is stored, to update the web folder = publish live the changes.

post-commit:

#!/bin/sh

REPOS="$1"
REV="$2"

# send diff email after commit
/usr/bin/svnnotify -r $REV -C -d -H HTML::ColorDiff \
    -p $REPOS -f 'svn@cle.sk' \
    --subject-prefix "[$REV] `svnlook author -r $REV $REPOS`" \
    --to-regex-map 'someone@somewhere.net=^(www/pm|www/tt-pm)' \
    --to-regex-map 'someoneelse@somewhereelse.net=^(www/pm|www/tt-pm)' 

# update bratislava.pm.org site after commit
if [ "`svnlook changed -r $REV $REPOS | grep '^....www/pm'`" ]; then
    sudo -H -u localuser /path/to/update-ba.pm.org;
fi

comments powered by Disqus