factor/extra/webapps/mason/docs-update/docs-update.factor

35 lines
1.0 KiB
Factor
Raw Normal View History

! Copyright (C) 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
2010-10-02 22:42:10 -04:00
USING: accessors furnace.actions help.html
http.server.responses io.directories io.directories.hierarchy
io.files io.launcher io.pathnames kernel mason.config memoize
namespaces sequences threads webapps.mason.utils ;
IN: webapps.mason.docs-update
2010-10-02 22:42:10 -04:00
: docs-path ( -- path )
docs-directory get "docs.tar.gz" append-path ;
: update-docs ( -- )
home [
"newdocs" exists? [ "newdocs" delete-tree ] when
"newdocs" make-directory
2010-10-02 22:42:10 -04:00
"newdocs" [ { "tar" "xfz" } docs-path suffix try-process ] with-directory
"docs" exists? [ "docs" "docs.old" move-file ] when
"newdocs/docs" "docs" move-file
"newdocs" delete-directory
"docs.old" exists? [ "docs.old" delete-tree ] when
\ load-index reset-memoized
] with-directory ;
: <docs-update-action> ( -- action )
<action>
[ validate-secret ] >>validate
[
[ update-docs ] "Documentation update" spawn drop
"OK" <text-content>
] >>submit ;