From e38bc79e06d83d2b00bc747384cb280a8dd81a7a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 16 Nov 2008 11:29:35 -0600 Subject: [PATCH] mason now generates HTML documentation using help.html --- basis/help/html/html.factor | 18 ++++----- extra/mason/common/common.factor | 10 ++++- extra/mason/config/config.factor | 19 +++++++-- extra/mason/help/help.factor | 23 +++++++++++ extra/mason/release/branch/branch.factor | 2 +- .../mason/release/upload/upload-tests.factor | 36 +---------------- extra/mason/release/upload/upload.factor | 40 ++++--------------- extra/mason/report/report.factor | 1 + extra/mason/test/test.factor | 3 +- 9 files changed, 68 insertions(+), 84 deletions(-) create mode 100644 extra/mason/help/help.factor diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index 8cefb4c112..c9e24f0091 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -92,16 +92,14 @@ M: topic browser-link-href topic>filename ; all-topics [ help>html ] each ; : generate-help ( -- ) - { "resource:core" "resource:basis" "resource:extra" } vocab-roots [ - load-everything - - "/tmp/docs/" make-directory - - "/tmp/docs/" [ + "docs" temp-file + [ make-directories ] + [ + [ generate-indices generate-help-files ] with-directory - ] with-variable ; + ] bi ; MEMO: load-index ( name -- index ) binary file-contents bytes>object ; @@ -119,10 +117,10 @@ M: result link-href href>> ; [ [ title>> ] compare ] sort ; : article-apropos ( string -- results ) - "articles.idx" offline-apropos ; + "articles.idx" temp-file offline-apropos ; : word-apropos ( string -- results ) - "words.idx" offline-apropos ; + "words.idx" temp-file offline-apropos ; : vocab-apropos ( string -- results ) - "vocabs.idx" offline-apropos ; + "vocabs.idx" temp-file offline-apropos ; diff --git a/extra/mason/common/common.factor b/extra/mason/common/common.factor index dfda85e4d7..24a1292be3 100644 --- a/extra/mason/common/common.factor +++ b/extra/mason/common/common.factor @@ -3,7 +3,7 @@ USING: kernel namespaces sequences splitting system accessors math.functions make io io.files io.launcher io.encodings.utf8 prettyprint combinators.short-circuit parser combinators -calendar calendar.format arrays mason.config ; +calendar calendar.format arrays mason.config locals ; IN: mason.common : short-running-process ( command -- ) @@ -13,6 +13,13 @@ IN: mason.common 15 minutes >>timeout try-process ; +:: upload-safely ( local username host remote -- ) + [let* | temp [ remote ".incomplete" append ] + scp-remote [ { username "@" host ":" temp } concat ] | + { "scp" local scp-remote } short-running-process + { "ssh" host "-l" username "mv" temp remote } short-running-process + ] ; + : eval-file ( file -- obj ) dup utf8 file-lines parse-fresh [ "Empty file: " swap append throw ] [ nip first ] if-empty ; @@ -71,6 +78,7 @@ SYMBOL: stamp : test-time-file "test-time" ; : help-lint-time-file "help-lint-time" ; : benchmark-time-file "benchmark-time" ; +: html-help-time-file "html-help-time" ; : benchmarks-file "benchmarks" ; diff --git a/extra/mason/config/config.factor b/extra/mason/config/config.factor index 0ce059c995..e4ef127413 100644 --- a/extra/mason/config/config.factor +++ b/extra/mason/config/config.factor @@ -33,10 +33,23 @@ target-os get-global [ ! Keep test-log around? SYMBOL: builder-debug -! Boolean. Do we release binaries and update the clean branch? -SYMBOL: upload-to-factorcode +SYMBOL: upload-help? -! The below are only needed if upload-to-factorcode is true. +! The below are only needed if upload-help is true. + +! Host with HTML help +SYMBOL: help-host + +! Username to log in. +SYMBOL: help-username + +! Directory to upload docs to. +SYMBOL: help-directory + +! Boolean. Do we release binaries and update the clean branch? +SYMBOL: upload-to-factorcode? + +! The below are only needed if upload-to-factorcode? is true. ! Host with clean git repo. SYMBOL: branch-host diff --git a/extra/mason/help/help.factor b/extra/mason/help/help.factor new file mode 100644 index 0000000000..1e3e1509c9 --- /dev/null +++ b/extra/mason/help/help.factor @@ -0,0 +1,23 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: help.html sequences io.files io.launcher make namespaces +kernel arrays mason.common mason.config ; +IN: mason.help + +: make-help-archive ( -- ) + "factor/temp" [ + { "tar" "cfz" "docs.tar.gz" "docs" } try-process + ] with-directory ; + +: upload-help-archive ( -- ) + "factor/temp/docs.tar.gz" + help-username get + help-host get + help-directory get "/docs.tar.gz" append + upload-safely ; + +: upload-help ( -- ) + upload-help? get [ + make-help-archive + upload-help-archive + ] when ; diff --git a/extra/mason/release/branch/branch.factor b/extra/mason/release/branch/branch.factor index 8872cda5b5..ff2632a9b3 100644 --- a/extra/mason/release/branch/branch.factor +++ b/extra/mason/release/branch/branch.factor @@ -45,4 +45,4 @@ IN: mason.release.branch ] with-directory ; : update-clean-branch ( -- ) - upload-to-factorcode get [ (update-clean-branch) ] when ; + upload-to-factorcode? get [ (update-clean-branch) ] when ; diff --git a/extra/mason/release/upload/upload-tests.factor b/extra/mason/release/upload/upload-tests.factor index 9f5300b129..73fc311399 100644 --- a/extra/mason/release/upload/upload-tests.factor +++ b/extra/mason/release/upload/upload-tests.factor @@ -1,38 +1,4 @@ IN: mason.release.upload.tests -USING: mason.release.upload mason.common mason.config -mason.common namespaces calendar tools.test ; - -[ - { - "scp" - "factor-linux-ppc-2008-09-11-23-12.tar.gz" - "slava@www.apple.com:/uploads/linux-ppc/factor-linux-ppc-2008-09-11-23-12.tar.gz.incomplete" - } - { - "ssh" - "www.apple.com" - "-l" "slava" - "mv" - "/uploads/linux-ppc/factor-linux-ppc-2008-09-11-23-12.tar.gz.incomplete" - "/uploads/linux-ppc/factor-linux-ppc-2008-09-11-23-12.tar.gz" - } -] [ - [ - "slava" upload-username set - "www.apple.com" upload-host set - "/uploads" upload-directory set - "linux" target-os set - "ppc" target-cpu set - T{ timestamp - { year 2008 } - { month 09 } - { day 11 } - { hour 23 } - { minute 12 } - } datestamp stamp set - upload-command - rename-command - ] with-scope -] unit-test +USING: mason.release.upload tools.test ; \ upload must-infer diff --git a/extra/mason/release/upload/upload.factor b/extra/mason/release/upload/upload.factor index 2bf18f1126..68f2ffcdb5 100644 --- a/extra/mason/release/upload/upload.factor +++ b/extra/mason/release/upload/upload.factor @@ -11,37 +11,11 @@ IN: mason.release.upload : remote-archive-name ( -- dest ) remote-location "/" archive-name 3append ; -: temp-archive-name ( -- dest ) - remote-archive-name ".incomplete" append ; - -: upload-command ( -- args ) - "scp" - archive-name - [ - upload-username get % "@" % - upload-host get % ":" % - temp-archive-name % - ] "" make - 3array ; - -: rename-command ( -- args ) - [ - "ssh" , - upload-host get , - "-l" , - upload-username get , - "mv" , - temp-archive-name , - remote-archive-name , - ] { } make ; - -: upload-temp-file ( -- ) - upload-command short-running-process ; - -: rename-temp-file ( -- ) - rename-command short-running-process ; - : upload ( -- ) - upload-to-factorcode get - [ upload-temp-file rename-temp-file ] - when ; + upload-to-factorcode? get [ + archive-name + upload-username get + upload-host get + remote-archive-name + upload-safely + ] when ; diff --git a/extra/mason/report/report.factor b/extra/mason/report/report.factor index 145686d621..0b5f21540a 100644 --- a/extra/mason/report/report.factor +++ b/extra/mason/report/report.factor @@ -46,6 +46,7 @@ IN: mason.report test-time-file time. help-lint-time-file time. benchmark-time-file time. + html-help-time-file time. nl diff --git a/extra/mason/test/test.factor b/extra/mason/test/test.factor index 58884175a3..8f35b08dea 100644 --- a/extra/mason/test/test.factor +++ b/extra/mason/test/test.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel namespaces assocs io.files io.encodings.utf8 prettyprint help.lint benchmark tools.time bootstrap.stage2 -tools.test tools.vocabs mason.common ; +tools.test tools.vocabs help.html mason.common ; IN: mason.test : do-load ( -- ) @@ -33,6 +33,7 @@ IN: mason.test [ do-tests ] benchmark test-time-file to-file [ do-help-lint ] benchmark help-lint-time-file to-file [ do-benchmarks ] benchmark benchmark-time-file to-file + [ generate-help ] benchmark html-help-time-file to-file ] with-directory ; MAIN: do-all \ No newline at end of file