2010-09-06 20:24:53 -04:00
|
|
|
! 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 ;
|
2010-09-06 20:24:53 -04:00
|
|
|
IN: webapps.mason.docs-update
|
|
|
|
|
2010-10-02 22:42:10 -04:00
|
|
|
: docs-path ( -- path )
|
|
|
|
docs-directory get "docs.tar.gz" append-path ;
|
2010-10-02 22:05:11 -04:00
|
|
|
|
2010-09-06 20:24:53 -04:00
|
|
|
: update-docs ( -- )
|
|
|
|
home [
|
2010-10-05 00:29:29 -04:00
|
|
|
"newdocs" exists? [ "newdocs" delete-tree ] when
|
|
|
|
|
2010-09-06 20:24:53 -04:00
|
|
|
"newdocs" make-directory
|
2010-10-02 22:42:10 -04:00
|
|
|
"newdocs" [ { "tar" "xfz" } docs-path suffix try-process ] with-directory
|
2010-09-06 20:24:53 -04:00
|
|
|
|
|
|
|
"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
|
|
|
|
[
|
2010-09-06 20:50:50 -04:00
|
|
|
[ update-docs ] "Documentation update" spawn drop
|
2014-04-22 16:47:25 -04:00
|
|
|
"OK" <text-content>
|
2010-09-06 20:24:53 -04:00
|
|
|
] >>submit ;
|