! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: fry irc.client irc.client.private kernel namespaces sequences threads io.encodings.8-bit io.launcher io splitting make mason.common mason.updates calendar ; IN: irc.gitbot : bot-profile ( -- obj ) "irc.freenode.org" 6667 "jackass" f ; : bot-channel ( -- seq ) "#concatenative" ; : bot-loop ( chat -- ) dup hear drop bot-loop ; : start-bot ( -- chat ) bot-profile [ connect-irc ] [ [ bot-channel dup ] dip '[ _ [ _ attach-chat ] [ bot-loop ] bi ] "GitBot" spawn drop ] bi ; : git-log ( from to -- lines ) [ "git-log" , "--no-merges" , "--pretty=format:%h %an: %s" , ".." swap 3append , ] { } make latin1 [ input-stream get lines ] with-process-reader ; : report-updates ( from to chat -- ) [ git-log ] dip [ 3 seconds sleep ] swap '[ _ speak ] interleave ; : check-for-updates ( chat -- ) [ git-id git-pull-cmd short-running-process git-id ] dip report-updates ;