]> gitweb.factorcode.org Git - factor.git/blob - basis/bootstrap/image/upload/upload.factor
f0edf85e653e3a12d0d65d9e0814784f5f8935f7
[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 ;
6 IN: bootstrap.image.upload
7
8 SYMBOL: upload-images-destination
9
10 : destination ( -- dest )
11   upload-images-destination get
12   "slava@factorcode.org:/var/www/factorcode.org/newsite/images/latest/"
13   or ;
14
15 : checksums ( -- temp ) "checksums.txt" temp-file ;
16
17 : boot-image-names ( -- seq ) images [ boot-image-name ] map ;
18
19 : compute-checksums ( -- )
20     checksums ascii [
21         boot-image-names [
22             [ write bl ]
23             [ openssl-md5 checksum-file hex-string print ]
24             bi
25         ] each
26     ] with-file-writer ;
27
28 : upload-images ( -- )
29     [
30         "scp" ,
31         boot-image-names %
32         "temp/checksums.txt" , destination ,
33     ] { } make try-process ;
34
35 : new-images ( -- )
36     "" resource-path
37       [ make-images compute-checksums upload-images ]
38     with-directory ;
39
40 MAIN: new-images