factor/extra/bootstrap/image/upload/upload.factor

36 lines
909 B
Factor
Raw Normal View History

! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: bootstrap.image.upload
USING: http.client crypto.md5 splitting assocs kernel io.files
bootstrap.image sequences io namespaces io.launcher math ;
SYMBOL: upload-images-destination
: destination ( -- dest )
upload-images-destination get
2008-03-02 18:51:35 -05:00
"slava@/var/www/factorcode.org/newsite/images/latest/"
or ;
2008-02-26 15:58:16 -05:00
: checksums "checksums.txt" temp-file ;
: boot-image-names images [ boot-image-name ] map ;
: compute-checksums ( -- )
2008-02-26 15:58:16 -05:00
checksums [
boot-image-names [ dup write bl file>md5str print ] each
] with-file-writer ;
: upload-images ( -- )
[
2008-02-26 16:22:39 -05:00
"scp" ,
boot-image-names %
"temp/checksums.txt" , destination ,
2008-02-08 22:15:29 -05:00
] { } make try-process ;
: new-images ( -- )
"" resource-path
[ make-images compute-checksums upload-images ]
with-directory ;
MAIN: new-images