mason now generates HTML documentation using help.html

db4
Slava Pestov 2008-11-16 11:29:35 -06:00
parent b917e1f051
commit e38bc79e06
9 changed files with 68 additions and 84 deletions

View File

@ -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 ;

View File

@ -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" ;

View File

@ -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

View File

@ -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 ;

View File

@ -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 ;

View File

@ -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

View File

@ -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 ;

View File

@ -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

View File

@ -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