Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2009-05-13 20:06:57 -05:00
commit 3685a0fed3
2 changed files with 26 additions and 13 deletions

View File

@ -1,11 +1,14 @@
! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov. ! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel system accessors namespaces splitting sequences USING: kernel system accessors namespaces splitting sequences
mason.config bootstrap.image ; mason.config bootstrap.image assocs ;
IN: mason.platform IN: mason.platform
: (platform) ( os cpu -- string )
{ { CHAR: . CHAR: - } } substitute "-" glue ;
: platform ( -- string ) : platform ( -- string )
target-os get "-" target-cpu get "." split "-" join 3append ; target-os get target-cpu get (platform) ;
: gnu-make ( -- string ) : gnu-make ( -- string )
target-os get { "freebsd" "openbsd" "netbsd" } member? "gmake" "make" ? ; target-os get { "freebsd" "openbsd" "netbsd" } member? "gmake" "make" ? ;

View File

@ -2,9 +2,15 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays combinators db db.tuples furnace.actions USING: accessors arrays combinators db db.tuples furnace.actions
http.server.responses kernel mason.platform mason.notify.server http.server.responses kernel mason.platform mason.notify.server
math.order sequences sorting splitting xml.syntax xml.writer ; math.order sequences sorting splitting xml.syntax xml.writer
io.pathnames io.encodings.utf8 io.files ;
IN: webapps.mason IN: webapps.mason
: log-file ( -- path ) home "mason.log" append-path ;
: recent-events ( -- xml )
log-file utf8 file-lines 10 short tail* "\n" join [XML <pre><-></pre> XML] ;
: git-link ( id -- link ) : git-link ( id -- link )
[ "http://github.com/slavapestov/factor/commit/" prepend ] keep [ "http://github.com/slavapestov/factor/commit/" prepend ] keep
[XML <a href=<->><-></a> XML] ; [XML <a href=<->><-></a> XML] ;
@ -55,20 +61,24 @@ IN: webapps.mason
</table> </table>
XML] ; XML] ;
: machine-report ( builders -- xml ) : machine-report ( -- xml )
[ machine-table ] map builder new select-tuples
[ [ [ os>> ] [ cpu>> ] bi 2array ] compare ] sort
[ machine-table ] map ;
: build-farm-report ( -- xml )
recent-events
machine-report
[XML [XML
<h1>Build farm status</h1> <html>
<-> <head><title>Factor build farm</title></head>
<body><h1>Recent events</h1><-> <h1>Machine status</h1><-></body>
</html>
XML] ; XML] ;
: <machine-report-action> ( -- action ) : <build-farm-report-action> ( -- action )
<action> <action>
[ [
mason-db [ mason-db [ build-farm-report xml>string ] with-db
builder new select-tuples
[ [ [ os>> ] [ cpu>> ] bi 2array ] compare ] sort
machine-report xml>string
] with-db
"text/html" <content> "text/html" <content>
] >>display ; ] >>display ;