1 ! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays combinators locals io.directories
4 io.directories.hierarchy io.files io.launcher io.pathnames
5 kernel make mason.common mason.config mason.platform namespaces
6 prettyprint sequences ;
7 IN: mason.release.archive
9 : base-name ( -- string )
10 [ "factor-" % platform % "-" % stamp get % ] "" make ;
12 : extension ( os -- extension )
14 { "windows" [ ".zip" ] }
15 { "macosx" [ ".dmg" ] }
19 : archive-name ( -- string ) base-name target-os get extension append ;
21 :: make-windows-archive ( archive-name -- )
22 { "zip" "-r" archive-name "factor" } short-running-process ;
24 :: make-disk-image ( archive-name volume-name dmg-root -- )
25 { "hdiutil" "create" "-srcfolder" dmg-root "-fs" "HFS+" "-volname" volume-name archive-name } short-running-process ;
27 : make-macosx-archive ( archive-name -- )
28 "dmg-root" make-directory
29 "factor" "dmg-root" copy-tree-into
30 "factor" "dmg-root" make-disk-image
31 "dmg-root" really-delete-tree ;
33 :: make-unix-archive ( archive-name -- )
34 { "tar" "-cvzf" archive-name "factor" } short-running-process ;
36 : make-archive ( archive-name -- )
38 { "windows" [ make-windows-archive ] }
39 { "macosx" [ make-macosx-archive ] }
40 [ drop make-unix-archive ]
43 : releases ( -- path )
44 builds-dir get "releases" append-path dup make-directories ;
46 : save-archive ( archive-name -- )
47 releases move-file-into ;