builder.release: refactor and cleanup
parent
c5f5e0a61a
commit
b1a9ba8806
|
@ -1,12 +1,17 @@
|
||||||
|
|
||||||
USING: kernel namespaces sequences combinators io.files io.launcher
|
USING: kernel system namespaces sequences splitting combinators
|
||||||
|
io.files io.launcher
|
||||||
bake combinators.cleave builder.common builder.util ;
|
bake combinators.cleave builder.common builder.util ;
|
||||||
|
|
||||||
IN: builder.release
|
IN: builder.release
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: releases ( -- path ) builds "/releases" append dup make-directory ;
|
: releases ( -- path )
|
||||||
|
builds "releases" path+
|
||||||
|
dup exists? not
|
||||||
|
[ dup make-directory ]
|
||||||
|
when ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
@ -34,8 +39,6 @@ IN: builder.release
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
USING: system sequences splitting ;
|
|
||||||
|
|
||||||
: cpu- ( -- cpu ) cpu "." split "-" join ;
|
: cpu- ( -- cpu ) cpu "." split "-" join ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
@ -57,70 +60,46 @@ USING: system sequences splitting ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: move-file ( source destination -- )
|
: windows-archive-cmd ( -- cmd ) { "zip" "-r" archive-name "factor" } ;
|
||||||
swap { "mv" , , } bake run-process drop ;
|
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
: linux-release ( -- )
|
|
||||||
|
|
||||||
"factor" cd
|
|
||||||
|
|
||||||
{ "rm" "-rf" "Factor.app" } run-process drop
|
|
||||||
|
|
||||||
{ "rm" "-rf" common-files } to-strings run-process drop
|
|
||||||
|
|
||||||
".." cd
|
|
||||||
|
|
||||||
{ "tar" "-cvzf" archive-name "factor" } to-strings run-process drop
|
|
||||||
|
|
||||||
archive-name releases move-file ;
|
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
: windows-release ( -- )
|
|
||||||
|
|
||||||
"factor" cd
|
|
||||||
|
|
||||||
{ "rm" "-rf" "Factor.app" } run-process drop
|
|
||||||
|
|
||||||
{ "rm" "-rf" common-files } to-strings run-process drop
|
|
||||||
|
|
||||||
".." cd
|
|
||||||
|
|
||||||
{ "zip" "-r" archive-name "factor" } to-strings run-process drop
|
|
||||||
|
|
||||||
archive-name releases move-file ;
|
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
: macosx-release ( -- )
|
|
||||||
|
|
||||||
"factor" cd
|
|
||||||
|
|
||||||
{ "rm" "-rf" common-files } to-strings run-process drop
|
|
||||||
|
|
||||||
".." cd
|
|
||||||
|
|
||||||
|
: macosx-archive-cmd ( -- cmd )
|
||||||
{ "hdiutil" "create"
|
{ "hdiutil" "create"
|
||||||
"-srcfolder" "factor"
|
"-srcfolder" "factor"
|
||||||
"-fs" "HFS+"
|
"-fs" "HFS+"
|
||||||
"-volname" "factor"
|
"-volname" "factor"
|
||||||
archive-name }
|
archive-name } ;
|
||||||
to-strings run-process drop
|
|
||||||
|
|
||||||
archive-name releases move-file ;
|
: unix-archive-cmd ( -- cmd ) { "tar" "-cvzf" archive-name "factor" } ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
: archive-cmd ( -- cmd )
|
||||||
|
{
|
||||||
|
{ [ windows? ] [ windows-archive-cmd ] }
|
||||||
|
{ [ macosx? ] [ macosx-archive-cmd ] }
|
||||||
|
{ [ unix? ] [ unix-archive-cmd ] }
|
||||||
|
}
|
||||||
|
cond ;
|
||||||
|
|
||||||
|
: make-archive ( -- ) archive-cmd to-strings try-process ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
: remove-common-files ( -- )
|
||||||
|
{ "rm" "-rf" common-files } to-strings try-process ;
|
||||||
|
|
||||||
|
: remove-factor-app ( -- )
|
||||||
|
macosx? not [ { "rm" "-rf" "Factor.app" } try-process ] when ;
|
||||||
|
|
||||||
: release ( -- )
|
: release ( -- )
|
||||||
os
|
"factor"
|
||||||
{
|
[
|
||||||
{ "linux" [ linux-release ] }
|
remove-factor-app
|
||||||
{ "winnt" [ windows-release ] }
|
remove-common-files
|
||||||
{ "macosx" [ macosx-release ] }
|
]
|
||||||
}
|
with-directory
|
||||||
case ;
|
make-archive
|
||||||
|
archive-name releases move-file-into ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue