Created
September 9, 2010 02:46
-
-
Save kiy0taka/571272 to your computer and use it in GitHub Desktop.
Using Groovy to SVN post-commit hook: IRC Bot to print commit Message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('pircbot:pircbot:1.4.2') | |
import org.jibble.pircbot.*; | |
def (host, port, channel) = ['<Server>', <Port>, '<Channel>'] | |
def bot = [:] as PircBot | |
bot.name = 'groovy_bot' | |
bot.encoding = 'ISO-2022-JP' | |
bot.connect host, port | |
bot.joinChannel channel | |
bot.sendRawLine(args*.split('\n').flatten().collect{"PRIVMSG $channel :$it"}.join('\n')) | |
bot.disconnect() | |
System.exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export LANG=ja_JP.UTF-8 | |
export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk/ | |
export GROOVY_HOME=/usr/local/groovy | |
export PATH=$JAVA_HOME/bin:$GROOVY_HOME/bin:$PATH | |
REPOS="$1" | |
REV="$2" | |
LOG=`svnlook log -r $REV $REPOS` | |
AUTHOR=`svnlook author -r $REV $REPOS` | |
CHANGES=`svnlook changed -r $REV $REPOS` | |
groovy /opt/svn/hoge/hooks/commit-irc.groovy "$AUTHOR" "$LOG" "$CHANGES" >> /tmp/post-commit.log 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Git.