1 ! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays combinators 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 ( -- extension )
14 { "winnt" [ ".zip" ] }
15 { "macosx" [ ".dmg" ] }
19 : archive-name ( -- string ) base-name extension append ;
21 : make-windows-archive ( -- )
22 [ "zip" , "-r" , archive-name , "factor" , ] { } make try-process ;
24 : make-macosx-archive ( -- )
25 { "mkdir" "dmg-root" } try-process
26 { "cp" "-R" "factor" "dmg-root" } try-process
28 "-srcfolder" "dmg-root"
31 archive-name suffix try-process
32 "dmg-root" delete-tree ;
34 : make-unix-archive ( -- )
35 [ "tar" , "-cvzf" , archive-name , "factor" , ] { } make try-process ;
39 { "winnt" [ make-windows-archive ] }
40 { "macosx" [ make-macosx-archive ] }
41 [ drop make-unix-archive ]
44 : releases ( -- path )
45 builds-dir get "releases" append-path dup make-directories ;
48 archive-name releases move-file-into ;