SVNにはpost-commitがあるから、たぶん楽勝。
環境もなんでもいいんだろうけど、手っ取り早そうなPHPで。
pearライブラリ検索
> pear search IR
Retrieving data...0%.MATCHED PACKAGES, CHANNEL PEAR.PHP.NET:=======================================PACKAGE STABLE/(LATEST) LOCALNet_IRC 0.0.7 (beta) IRC Client ClassNet_SmartIRC 1.0.2 (stable) 1.0.2 Net_SmartIRC is a PHP class for communication with IRC networks
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
<?php | |
// (*´・ω・)(・ω・`*)< イマイチ! | |
include_once('Net/SmartIRC.php'); | |
if(count($argv) != 4){ | |
die("error! invalid argment [php xxx.php 'author' 'log' 'changes']"); | |
} | |
class mybot | |
{ | |
function irc_disconnect(&$irc) | |
{ | |
global $saytime_once_id; | |
$irc->unregisterTimeid($saytime_once_id); | |
$irc->quit('bye'); | |
} | |
} | |
$bot = &new mybot(); | |
$irc = &new Net_SmartIRC(); | |
$irc->setDebug(SMARTIRC_DEBUG_NOTICE); | |
//$irc->setDebug(SMARTIRC_DEBUG_ALL); | |
$irc->setUseSockets(TRUE); | |
$saytime_once_id = $irc->registerTimehandler(3000, $bot, 'irc_disconnect'); | |
// チャンネルにjoin | |
$irc->connect('irc.server.host', 6667); | |
$irc->login('svn-bot', 'bot', 8, 'bot'); | |
$irc->join(array('#sandbox')); | |
// メッセージ送信 | |
$message = 'SVN Updated!' . " [" . $argv[1] . "][" . $argv[2] . "][" . $argv[3] . "]"; | |
$irc->message(SMARTIRC_TYPE_CHANNEL, '#sandbox', $message); | |
$irc->listen(); | |
$irc->disconnect(); | |
?> |
[root@hoge hooks]# vi post-commit#!/bin/sAUTHOR=`svnlook author -r $REV $REPOS`LOG=`svnlook log -r $REV $REPOS`CHANGES=`svnlook changed -r $REV $REPOS`
php /home/e2info/developer/svn-irc.php "$AUTHOR" "$LOG" "$CHANGES"
どうかな
できた!!日本語よめないのはめんどくさいからまた今度で。
(*´・ω・)かねこ(・ω・`*)
0 件のコメント:
コメントを投稿