Cleaning up deployment tool

db4
Slava Pestov 2008-04-20 00:49:42 -05:00
parent 10ee5cf8ed
commit 851c54ea7a
5 changed files with 39 additions and 34 deletions
extra
windows/shell32

View File

@ -1,10 +1,13 @@
! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.deploy.backend system vocabs.loader kernel ;
USING: tools.deploy.backend system vocabs.loader kernel
combinators ;
IN: tools.deploy
: deploy ( vocab -- ) deploy* ;
os macosx? [ "tools.deploy.macosx" require ] when
os winnt? [ "tools.deploy.windows" require ] when
os unix? [ "tools.deploy.unix" require ] when
{
{ [ os macosx? ] [ "tools.deploy.macosx" ] }
{ [ os winnt? ] [ "tools.deploy.windows" ] }
{ [ os unix? ] [ "tools.deploy.unix" ] }
} cond require

View File

@ -31,10 +31,14 @@ IN: tools.deploy.macosx
write-plist ;
: create-app-dir ( vocab bundle-name -- vm )
dup "Frameworks" copy-bundle-dir
dup "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir
dup "Contents/Resources/" copy-fonts
2dup create-app-plist "Contents/MacOS/" append-path "" copy-vm ;
[
nip
[ "Frameworks" copy-bundle-dir ]
[ "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir ]
[ "Contents/Resources/" copy-fonts ] tri
]
[ create-app-plist ]
[ "Contents/MacOS/" append-path "" copy-vm ] 2tri ;
: deploy.app-image ( vocab bundle-name -- str )
[ % "/Contents/Resources/" % % ".image" % ] "" make ;
@ -43,9 +47,8 @@ IN: tools.deploy.macosx
deploy-name get ".app" append ;
: show-in-finder ( path -- )
NSWorkspace
-> sharedWorkspace
over <NSString> rot parent-directory <NSString>
[ NSWorkspace -> sharedWorkspace ]
[ normalize-path [ <NSString> ] [ parent-directory <NSString> ] bi ] bi*
-> selectFile:inFileViewerRootedAtPath: drop ;
M: macosx deploy* ( vocab -- )
@ -56,6 +59,6 @@ M: macosx deploy* ( vocab -- )
[ bundle-name create-app-dir ] keep
[ bundle-name deploy.app-image ] keep
namespace make-deploy-image
bundle-name normalize-path show-in-finder
bundle-name show-in-finder
] bind
] with-directory ;

View File

@ -3,21 +3,21 @@
USING: io io.files io.backend kernel namespaces sequences
system tools.deploy.backend tools.deploy.config assocs
hashtables prettyprint ;
IN: tools.deploy.linux
: create-app-dir ( vocab bundle-name -- vm )
dup "" copy-fonts
"" copy-vm ;
: bundle-name ( -- str )
deploy-name get ;
IN: tools.deploy.unix
M: linux deploy* ( vocab -- )
"." resource-path [
dup deploy-config [
[ bundle-name create-app-dir ] keep
[ bundle-name image-name ] keep
namespace make-deploy-image
bundle-name normalize-path [ "Binary deployed to " % % "." % ] "" make print
] bind
] with-directory ;
: create-app-dir ( vocab bundle-name -- vm )
dup "" copy-fonts
"" copy-vm ;
: bundle-name ( -- str )
deploy-name get ;
M: unix deploy* ( vocab -- )
"." resource-path [
dup deploy-config [
[ bundle-name create-app-dir ] keep
[ bundle-name image-name ] keep
namespace make-deploy-image
bundle-name normalize-path [ "Binary deployed to " % % "." % ] "" make print
] bind
] with-directory ;

View File

@ -6,8 +6,7 @@ prettyprint windows.shell32 windows.user32 ;
IN: tools.deploy.windows
: copy-dlls ( bundle-name -- )
{ "freetype6.dll" "zlib1.dll" "factor.dll" }
[ resource-path ] map
{ "resource:freetype6.dll" "resource:zlib1.dll" "resource:factor.dll" }
swap copy-files-into ;
: create-exe-dir ( vocab bundle-name -- vm )
@ -21,6 +20,6 @@ M: winnt deploy*
[ deploy-name get create-exe-dir ] keep
[ deploy-name get image-name ] keep
[ namespace make-deploy-image ] keep
(normalize-path) open-in-explorer
open-in-explorer
] bind
] with-directory ;

View File

@ -1,6 +1,6 @@
USING: alien alien.c-types alien.syntax combinators
kernel windows windows.user32 windows.ole32
windows.com windows.com.syntax ;
windows.com windows.com.syntax io.files ;
IN: windows.shell32
: CSIDL_DESKTOP HEX: 00 ; inline
@ -83,7 +83,7 @@ FUNCTION: HINSTANCE ShellExecuteW ( HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFi
: ShellExecute ShellExecuteW ; inline
: open-in-explorer ( dir -- )
f "open" rot f f SW_SHOWNORMAL ShellExecute drop ;
f "open" rot (normalize-path) f f SW_SHOWNORMAL ShellExecute drop ;
: shell32-error ( n -- )
ole32-error ; inline