factor/extra/mason/notify/notify.factor

55 lines
1.5 KiB
Factor
Raw Normal View History

! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays accessors io io.sockets io.encodings.utf8 io.files
io.launcher kernel make mason.config mason.common mason.email
mason.twitter namespaces sequences prettyprint fry ;
IN: mason.notify
: status-notify ( input-file args -- )
status-host get [
[
"ssh" , status-host get , "-l" , status-username get ,
"./mason-notify" ,
short-host-name ,
target-cpu get ,
target-os get ,
] { } make prepend
[ 5 ] 2dip '[
<process>
2009-05-21 01:08:43 -04:00
_ >>stdin
2009-05-11 23:04:54 -04:00
_ >>command
short-running-process
] retry
] [ 2drop ] if ;
: notify-begin-build ( git-id -- )
[ "Starting build of GIT ID " write print flush ]
[ f swap "git-id" swap 2array status-notify ]
bi ;
: notify-make-vm ( -- )
"Compiling VM" print flush
f { "make-vm" } status-notify ;
: notify-boot ( -- )
"Bootstrapping" print flush
f { "boot" } status-notify ;
: notify-test ( -- )
"Running tests" print flush
f { "test" } status-notify ;
: notify-report ( status -- )
2009-04-25 17:52:23 -04:00
[ "Build finished with status: " write . flush ]
[
[ "report" ] dip
[ [ utf8 file-contents ] dip email-report ]
[ "report" swap name>> 2array status-notify ]
2bi
] bi ;
: notify-release ( archive-name -- )
2009-05-21 01:08:43 -04:00
[ "Uploaded " prepend [ print flush ] [ mason-tweet ] bi ]
[ f swap "release" swap 2array status-notify ]
bi ;