From cc96b3bd7e20881169c3e4547e59c28126a4643f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 13 May 2009 19:47:00 -0500 Subject: [PATCH 1/3] Update mason.platform for webapps.mason --- extra/mason/platform/platform.factor | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extra/mason/platform/platform.factor b/extra/mason/platform/platform.factor index 59c525f5ea..d6be8654c5 100644 --- a/extra/mason/platform/platform.factor +++ b/extra/mason/platform/platform.factor @@ -1,11 +1,14 @@ ! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel system accessors namespaces splitting sequences -mason.config bootstrap.image ; +mason.config bootstrap.image assocs ; IN: mason.platform +: (platform) ( os cpu -- string ) + { { CHAR: . CHAR: - } } substitute "-" glue ; + : platform ( -- string ) - target-os get "-" target-cpu get "." split "-" join 3append ; + target-os get target-cpu get (platform) ; : gnu-make ( -- string ) target-os get { "freebsd" "openbsd" "netbsd" } member? "gmake" "make" ? ; From 9f39a759284528fdf6122a48c0cb839ede8b5409 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 13 May 2009 19:53:52 -0500 Subject: [PATCH 2/3] webapps.mason: work on it some more --- extra/webapps/mason/mason.factor | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/extra/webapps/mason/mason.factor b/extra/webapps/mason/mason.factor index 63b042077e..6cb24a5f9a 100644 --- a/extra/webapps/mason/mason.factor +++ b/extra/webapps/mason/mason.factor @@ -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
<->
XML] ; + : git-link ( id -- link ) [ "http://github.com/slavapestov/factor/commit/" prepend ] keep [XML ><-> XML] ; @@ -55,20 +61,24 @@ IN: webapps.mason 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 -

Build farm status

- <-> + + Factor build farm +

Recent events

<->

Machine status

<-> + XML] ; : ( -- 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" ] >>display ; \ No newline at end of file From 5bae938c7e43f266e7086f92dc0a5e69ff48b4c2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 13 May 2009 19:55:33 -0500 Subject: [PATCH 3/3] Rename a word --- extra/webapps/mason/mason.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/webapps/mason/mason.factor b/extra/webapps/mason/mason.factor index 6cb24a5f9a..ea7040ac6e 100644 --- a/extra/webapps/mason/mason.factor +++ b/extra/webapps/mason/mason.factor @@ -76,7 +76,7 @@ IN: webapps.mason XML] ; -: ( -- action ) +: ( -- action ) [ mason-db [ build-farm-report xml>string ] with-db