tools.deploy: disable opening directory after deploy for tests.

db4
John Benediktsson 2015-08-05 11:01:56 -07:00
parent de56964a06
commit b8675e4470
5 changed files with 21 additions and 8 deletions

View File

@ -139,6 +139,9 @@ DEFER: ?make-staging-image
vm image vocab config make-deploy-image vm image vocab config make-deploy-image
image vm embed-image ; image vm embed-image ;
SYMBOL: open-directory-after-deploy?
t open-directory-after-deploy? set-global
HOOK: deploy* os ( vocab -- ) HOOK: deploy* os ( vocab -- )
HOOK: deploy-path os ( vocab -- path ) HOOK: deploy-path os ( vocab -- path )

View File

@ -19,9 +19,11 @@ delete-staging-images
{ } [ "hello-world" shake-and-bake 550000 small-enough? ] unit-test { } [ "hello-world" shake-and-bake 550000 small-enough? ] unit-test
{ "Hello world\n" } [ { "Hello world\n" } [
"hello-world" deploy f open-directory-after-deploy? [
"hello-world" deploy-path 1array "hello-world" deploy
ascii [ contents ] with-process-reader "hello-world" deploy-path 1array
ascii [ contents ] with-process-reader
] with-variable
] unit-test ] unit-test
{ } [ "sudoku" shake-and-bake 800000 small-enough? ] unit-test { } [ "sudoku" shake-and-bake 800000 small-enough? ] unit-test

View File

@ -72,6 +72,9 @@ IN: tools.deploy.macosx
[ normalize-path [ <NSString> ] [ parent-directory <NSString> ] bi ] bi* [ normalize-path [ <NSString> ] [ parent-directory <NSString> ] bi ] bi*
-> selectFile:inFileViewerRootedAtPath: drop ; -> selectFile:inFileViewerRootedAtPath: drop ;
: ?show-in-finder ( path -- )
open-directory-after-deploy? get [ show-in-finder ] [ drop ] if ;
: deploy.app-image-name ( vocab bundle-name -- str ) : deploy.app-image-name ( vocab bundle-name -- str )
[ % "/Contents/Resources/" % % ".image" % ] "" make ; [ % "/Contents/Resources/" % % ".image" % ] "" make ;
@ -85,7 +88,7 @@ IN: tools.deploy.macosx
bundle-name bundle-name
[ "Contents/Resources" copy-resources ] [ "Contents/Resources" copy-resources ]
[ "Contents/Frameworks" copy-libraries ] 2bi [ "Contents/Frameworks" copy-libraries ] 2bi
bundle-name show-in-finder bundle-name ?show-in-finder
] with-variables ] with-variables
] with-directory ; ] with-directory ;

View File

@ -3,8 +3,7 @@
USING: io io.backend io.directories io.files.info.unix USING: io io.backend io.directories io.files.info.unix
io.pathnames kernel namespaces sequences system io.pathnames kernel namespaces sequences system
tools.deploy.backend tools.deploy.config tools.deploy.backend tools.deploy.config
tools.deploy.config.editor ; tools.deploy.config.editor webbrowser ;
QUALIFIED: webbrowser
IN: tools.deploy.unix IN: tools.deploy.unix
: create-app-dir ( vocab bundle-name -- vm ) : create-app-dir ( vocab bundle-name -- vm )
@ -14,6 +13,9 @@ IN: tools.deploy.unix
: bundle-name ( -- str ) : bundle-name ( -- str )
deploy-name get ; deploy-name get ;
: ?open-file ( path -- )
open-directory-after-deploy? get [ open-file ] [ drop ] if ;
M: unix deploy* M: unix deploy*
deploy-directory get [ deploy-directory get [
dup deploy-config [ dup deploy-config [
@ -22,7 +24,7 @@ M: unix deploy*
namespace make-deploy-image-executable namespace make-deploy-image-executable
bundle-name "" [ copy-resources ] [ copy-libraries ] 3bi bundle-name "" [ copy-resources ] [ copy-libraries ] 3bi
bundle-name normalize-path "Binary deployed to " "." surround print bundle-name normalize-path "Binary deployed to " "." surround print
bundle-name webbrowser:open-file bundle-name ?open-file
] with-variables ] with-variables
] with-directory ; ] with-directory ;

View File

@ -22,6 +22,9 @@ CONSTANT: app-icon-resource-id "APPICON"
[ f "open" ] dip absolute-path normalize-separators [ f "open" ] dip absolute-path normalize-separators
f f SW_SHOWNORMAL ShellExecute drop ; f f SW_SHOWNORMAL ShellExecute drop ;
: ?open-in-explorer ( dir -- )
open-directory-after-deploy? get [ open-in-explorer ] [ drop ] if ;
: embed-ico ( vm-path vocab -- ) : embed-ico ( vm-path vocab -- )
dup vocab-windows-icon-path vocab-append-path dup exists? dup vocab-windows-icon-path vocab-append-path dup exists?
[ binary file-contents app-icon-resource-id embed-icon-resource ] [ binary file-contents app-icon-resource-id embed-icon-resource ]
@ -37,7 +40,7 @@ M: windows deploy*
[ drop deployed-image-name ] [ drop deployed-image-name ]
[ drop namespace make-deploy-image-executable ] [ drop namespace make-deploy-image-executable ]
[ nip "" [ copy-resources ] [ copy-libraries ] 3bi ] [ nip "" [ copy-resources ] [ copy-libraries ] 3bi ]
[ nip open-in-explorer ] [ nip ?open-in-explorer ]
} 2cleave } 2cleave
] with-variables ] with-variables
] with-directory ; ] with-directory ;