]> gitweb.factorcode.org Git - factor.git/commitdiff
webapps.mason: work on it some more
authorSlava Pestov <slava@shill.internal.stack-effects.com>
Thu, 14 May 2009 00:53:52 +0000 (19:53 -0500)
committerSlava Pestov <slava@shill.internal.stack-effects.com>
Thu, 14 May 2009 00:53:52 +0000 (19:53 -0500)
extra/webapps/mason/mason.factor

index 63b042077e84af2e78b7cc2bd8e096f4da78fc00..6cb24a5f9a97b3313a503a8e7ff305cc705bed35 100644 (file)
@@ -2,9 +2,15 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays combinators db db.tuples furnace.actions
 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
 
+: 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 )
     [ "http://github.com/slavapestov/factor/commit/" prepend ] keep
     [XML <a href=<->><-></a> XML] ;
@@ -55,20 +61,24 @@ IN: webapps.mason
     </table>
     XML] ;
 
-: machine-report ( builders -- xml )
-    [ machine-table ] map
+: machine-report ( -- xml )
+    builder new select-tuples
+    [ [ [ os>> ] [ cpu>> ] bi 2array ] compare ] sort
+    [ machine-table ] map ;
+
+: build-farm-report ( -- xml )
+    recent-events
+    machine-report
     [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] ;
 
 : <machine-report-action> ( -- action )
     <action>
         [
-            mason-db [
-                builder new select-tuples
-                [ [ [ os>> ] [ cpu>> ] bi 2array ] compare ] sort
-                machine-report xml>string
-            ] with-db
+            mason-db [ build-farm-report xml>string ] with-db
             "text/html" <content>
         ] >>display ;
\ No newline at end of file