tools.deploy.*: refactoring of the deploy* words
The open-file word from webbrowser can be used to open the deploy-directory after the deploy is done.char-rename
parent
63524a7425
commit
1a1e95f669
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2007, 2010 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: combinators command-line kernel namespaces sequences
|
||||
system tools.deploy.backend tools.deploy.config.editor vocabs
|
||||
vocabs.loader ;
|
||||
USING: combinators command-line io.directories kernel namespaces
|
||||
sequences system tools.deploy.backend tools.deploy.config
|
||||
tools.deploy.config.editor vocabs vocabs.loader ;
|
||||
IN: tools.deploy
|
||||
|
||||
ERROR: no-vocab-main vocab ;
|
||||
|
@ -11,7 +11,13 @@ ERROR: no-vocab-main vocab ;
|
|||
[ require ] keep dup vocab-main [ no-vocab-main ] unless ;
|
||||
|
||||
: deploy ( vocab -- )
|
||||
dup find-vocab-root [ check-vocab-main deploy* ] [ no-vocab ] if ;
|
||||
dup find-vocab-root [ no-vocab ] unless
|
||||
check-vocab-main
|
||||
deploy-directory get [
|
||||
dup deploy-config [
|
||||
deploy*
|
||||
] with-variables
|
||||
] with-directory ;
|
||||
|
||||
: deploy-image-only ( vocab image -- )
|
||||
[ vm-path ] 2dip
|
||||
|
|
|
@ -6,7 +6,7 @@ sequences system tools.deploy.backend tools.deploy.config
|
|||
tools.deploy.config.editor assocs hashtables prettyprint
|
||||
io.backend.unix cocoa io.encodings.utf8 io.backend
|
||||
cocoa.application cocoa.classes cocoa.plists
|
||||
combinators vocabs.metadata vocabs.loader ;
|
||||
combinators vocabs.metadata vocabs.loader webbrowser ;
|
||||
QUALIFIED-WITH: tools.deploy.unix unix
|
||||
IN: tools.deploy.macosx
|
||||
|
||||
|
@ -70,30 +70,18 @@ IN: tools.deploy.macosx
|
|||
: bundle-name ( -- string )
|
||||
deploy-name get ".app" append ;
|
||||
|
||||
: show-in-finder ( path -- )
|
||||
[ NSWorkspace -> sharedWorkspace ]
|
||||
[ normalize-path [ <NSString> ] [ parent-directory <NSString> ] bi ] bi*
|
||||
-> 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 )
|
||||
[ % "/Contents/Resources/" % % ".image" % ] "" make ;
|
||||
|
||||
: deploy-app-bundle ( vocab -- )
|
||||
deploy-directory get [
|
||||
dup deploy-config [
|
||||
bundle-name dup exists? [ delete-tree ] [ drop ] if
|
||||
[ bundle-name create-app-dir ] keep
|
||||
[ bundle-name deploy.app-image-name ] keep
|
||||
namespace make-deploy-image
|
||||
bundle-name
|
||||
[ "Contents/Resources" copy-resources ]
|
||||
[ "Contents/Frameworks" copy-libraries ] 2bi
|
||||
bundle-name ?show-in-finder
|
||||
] with-variables
|
||||
] with-directory ;
|
||||
bundle-name dup exists? [ delete-tree ] [ drop ] if
|
||||
[ bundle-name create-app-dir ] keep
|
||||
[ bundle-name deploy.app-image-name ] keep
|
||||
namespace make-deploy-image
|
||||
bundle-name
|
||||
[ "Contents/Resources" copy-resources ]
|
||||
[ "Contents/Frameworks" copy-libraries ] 2bi
|
||||
open-directory-after-deploy? get [ bundle-name open-file ] when ;
|
||||
|
||||
: deploy-app-bundle? ( vocab -- ? )
|
||||
deploy-config [ deploy-console? get not deploy-ui? get or ] with-variables ;
|
||||
|
|
|
@ -1,36 +1,26 @@
|
|||
! Copyright (C) 2008 James Cash
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: io io.backend io.directories io.files.info.unix
|
||||
io.pathnames kernel namespaces sequences system
|
||||
tools.deploy.backend tools.deploy.config
|
||||
tools.deploy.config.editor webbrowser ;
|
||||
USING: combinators io.backend io.directories io.files.info.unix
|
||||
io.pathnames kernel namespaces system tools.deploy.backend
|
||||
tools.deploy.config tools.deploy.config.editor webbrowser ;
|
||||
IN: tools.deploy.unix
|
||||
|
||||
: create-app-dir ( vocab bundle-name -- vm )
|
||||
copy-vm
|
||||
dup 0o755 set-file-permissions ;
|
||||
|
||||
: bundle-name ( -- str )
|
||||
deploy-name get ;
|
||||
|
||||
: ?open-file ( path -- )
|
||||
open-directory-after-deploy? get [ open-file ] [ drop ] if ;
|
||||
: create-app-dir ( vocab bundle-name -- vm-path )
|
||||
copy-vm dup 0o755 set-file-permissions ;
|
||||
|
||||
M: unix deploy*
|
||||
deploy-directory get [
|
||||
dup deploy-config [
|
||||
[ bundle-name create-app-dir ] keep
|
||||
[ deployed-image-name ] keep
|
||||
namespace make-deploy-image-executable
|
||||
bundle-name "" [ copy-resources ] [ copy-libraries ] 3bi
|
||||
bundle-name normalize-path "Binary deployed to " "." surround print
|
||||
bundle-name ?open-file
|
||||
] with-variables
|
||||
] with-directory ;
|
||||
deploy-name get
|
||||
{
|
||||
[ create-app-dir ]
|
||||
[ drop deployed-image-name ]
|
||||
[ drop namespace make-deploy-image-executable ]
|
||||
[ nip "" [ copy-resources ] [ copy-libraries ] 3bi ]
|
||||
[ nip open-directory-after-deploy? get [ open-file ] [ drop ] if ]
|
||||
} 2cleave ;
|
||||
|
||||
M: unix deploy-path
|
||||
deploy-directory get [
|
||||
dup deploy-config [
|
||||
bundle-name swap append-path normalize-path
|
||||
deploy-name get swap append-path normalize-path
|
||||
] with-variables
|
||||
] with-directory ;
|
||||
|
|
|
@ -5,7 +5,7 @@ io.encodings.binary io.files io.files.windows io.pathnames
|
|||
kernel locals namespaces splitting sequences system
|
||||
tools.deploy.backend tools.deploy.config
|
||||
tools.deploy.config.editor tools.deploy.windows.ico
|
||||
vocabs.loader vocabs.metadata windows.shell32 windows.user32 ;
|
||||
vocabs.loader vocabs.metadata webbrowser windows.user32 ;
|
||||
IN: tools.deploy.windows
|
||||
|
||||
CONSTANT: app-icon-resource-id "APPICON"
|
||||
|
@ -18,13 +18,6 @@ CONSTANT: app-icon-resource-id "APPICON"
|
|||
: create-exe-dir ( vocab bundle-name -- vm-path )
|
||||
deploy-console? get ".com" ".exe" ? copy-vm ;
|
||||
|
||||
: open-in-explorer ( dir -- )
|
||||
[ f "open" ] dip absolute-path normalize-separators
|
||||
f f SW_SHOWNORMAL ShellExecute drop ;
|
||||
|
||||
: ?open-in-explorer ( dir -- )
|
||||
open-directory-after-deploy? get [ open-in-explorer ] [ drop ] if ;
|
||||
|
||||
: vocab-windows-icon-path ( vocab -- string )
|
||||
vocab-dir "icon.ico" append-path ;
|
||||
|
||||
|
@ -34,19 +27,15 @@ CONSTANT: app-icon-resource-id "APPICON"
|
|||
[ 2drop ] if ;
|
||||
|
||||
M: windows deploy*
|
||||
deploy-directory get [
|
||||
dup deploy-config [
|
||||
deploy-name get
|
||||
{
|
||||
[ create-exe-dir dup ]
|
||||
[ drop embed-ico ]
|
||||
[ drop deployed-image-name ]
|
||||
[ drop namespace make-deploy-image-executable ]
|
||||
[ nip "resource:" [ copy-resources ] [ copy-libraries ] 3bi ]
|
||||
[ nip ?open-in-explorer ]
|
||||
} 2cleave
|
||||
] with-variables
|
||||
] with-directory ;
|
||||
deploy-name get
|
||||
{
|
||||
[ create-exe-dir dup ]
|
||||
[ drop embed-ico ]
|
||||
[ drop deployed-image-name ]
|
||||
[ drop namespace make-deploy-image-executable ]
|
||||
[ nip "resource:" [ copy-resources ] [ copy-libraries ] 3bi ]
|
||||
[ nip open-directory-after-deploy? get [ open-file ] [ drop ] if ]
|
||||
} 2cleave ;
|
||||
|
||||
M: windows deploy-path
|
||||
deploy-directory get [
|
||||
|
|
Loading…
Reference in New Issue