]> gitweb.factorcode.org Git - factor.git/blob - basis/bootstrap/image/upload/upload.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / bootstrap / image / upload / upload.factor
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: checksums checksums.openssl splitting assocs
4 kernel io.files bootstrap.image sequences io namespaces make
5 io.launcher math io.encodings.ascii io.files.temp io.pathnames
6 io.directories ;
7 IN: bootstrap.image.upload
8
9 SYMBOL: upload-images-destination
10
11 : destination ( -- dest )
12     upload-images-destination get
13     "slava@factorcode.org:/var/www/factorcode.org/newsite/images/latest/"
14     or ;
15
16 : checksums ( -- temp ) "checksums.txt" temp-file ;
17
18 : boot-image-names ( -- seq ) images [ boot-image-name ] map ;
19
20 : compute-checksums ( -- )
21     checksums ascii [
22         boot-image-names [
23             [ write bl ]
24             [ openssl-md5 checksum-file hex-string print ]
25             bi
26         ] each
27     ] with-file-writer ;
28
29 : upload-images ( -- )
30     [
31         "scp" ,
32         boot-image-names %
33         "temp/checksums.txt" , destination ,
34     ] { } make try-process ;
35
36 : new-images ( -- )
37     "" resource-path
38       [ make-images compute-checksums upload-images ]
39     with-directory ;
40
41 MAIN: new-images