IRKERPATH=/usr/bin/
-function help() {
+function help_irker() {
echo "Required config settings:"
echo " git config irker.channels 'channel1 channel2 ..'"
echo " git config irker.project 'Project name'"
new=$2
refname=$3
+ echo "irker $1 $2 $3"
+ return
+
if [ "x$old" = "x0000000000000000000000000000000000000000" ]; then
# We're pushing into an empty repo, so we need a different command
# to get the rev list
$(git rev-list --reverse ${old}..${new})
fi
}
-
-channels=$(git config --get irker.channels)
-
-while read line; do
- set -- $line
- if [ -n "$channels" ]; then
- notify_irker $*
- fi
- RET=$?
-done
-
-exit $RET
+#!/bin/bash
+HOOKDIR=$(dirname $0)
+
+# Load functions
+. $HOOKDIR/irker
+. $HOOKDIR/slack
+
+
+channels=$(git config --get irker.channels)
+
+webhook_url=$(git config --get hooks.slack.webhook-url)
+
+while read line; do
+ set -- $line
+ if [ -n "$channels" ]; then
+ notify_irker $*
+ fi
+ if [ -n "$webhook_url" ]; then
+ notify_slack $*
+ fi
+ RET=$?
+done
+exit $RET
# Based on post-receive.irc by Mikael Fridh <frimik@gmail.com> https://gist.github.com/1821358
#
-function help() {
+function help_slack() {
echo "Required config settings:"
echo " git config hooks.slack.webhook-url 'https://hooks.slack.com/services/...'"
echo " git config hooks.slack.channel 'general'"
newrev=$(git rev-parse $2)
refname="$3"
+ echo "slack $1 $2 $3"
+ return
+
# --- Interpret
# 0000->1234 (create)
# 1234->2345 (update)
"$webhook_url" \
>/dev/null
}
-
-webhook_url=$(git config --get hooks.slack.webhook-url)
-
-while read line; do
- set -- $line
- if [ -n "$webhook_url" ]; then
- notify_slack $*
- fi
-
- RET=$?
-done
-
-exit $RET