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.
|
! Copyright (C) 2007, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: combinators command-line kernel namespaces sequences
|
USING: combinators command-line io.directories kernel namespaces
|
||||||
system tools.deploy.backend tools.deploy.config.editor vocabs
|
sequences system tools.deploy.backend tools.deploy.config
|
||||||
vocabs.loader ;
|
tools.deploy.config.editor vocabs vocabs.loader ;
|
||||||
IN: tools.deploy
|
IN: tools.deploy
|
||||||
|
|
||||||
ERROR: no-vocab-main vocab ;
|
ERROR: no-vocab-main vocab ;
|
||||||
|
@ -11,7 +11,13 @@ ERROR: no-vocab-main vocab ;
|
||||||
[ require ] keep dup vocab-main [ no-vocab-main ] unless ;
|
[ require ] keep dup vocab-main [ no-vocab-main ] unless ;
|
||||||
|
|
||||||
: deploy ( vocab -- )
|
: 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 -- )
|
: deploy-image-only ( vocab image -- )
|
||||||
[ vm-path ] 2dip
|
[ vm-path ] 2dip
|
||||||
|
|
|
@ -6,7 +6,7 @@ sequences system tools.deploy.backend tools.deploy.config
|
||||||
tools.deploy.config.editor assocs hashtables prettyprint
|
tools.deploy.config.editor assocs hashtables prettyprint
|
||||||
io.backend.unix cocoa io.encodings.utf8 io.backend
|
io.backend.unix cocoa io.encodings.utf8 io.backend
|
||||||
cocoa.application cocoa.classes cocoa.plists
|
cocoa.application cocoa.classes cocoa.plists
|
||||||
combinators vocabs.metadata vocabs.loader ;
|
combinators vocabs.metadata vocabs.loader webbrowser ;
|
||||||
QUALIFIED-WITH: tools.deploy.unix unix
|
QUALIFIED-WITH: tools.deploy.unix unix
|
||||||
IN: tools.deploy.macosx
|
IN: tools.deploy.macosx
|
||||||
|
|
||||||
|
@ -70,20 +70,10 @@ IN: tools.deploy.macosx
|
||||||
: bundle-name ( -- string )
|
: bundle-name ( -- string )
|
||||||
deploy-name get ".app" append ;
|
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 )
|
: deploy.app-image-name ( vocab bundle-name -- str )
|
||||||
[ % "/Contents/Resources/" % % ".image" % ] "" make ;
|
[ % "/Contents/Resources/" % % ".image" % ] "" make ;
|
||||||
|
|
||||||
: deploy-app-bundle ( vocab -- )
|
: deploy-app-bundle ( vocab -- )
|
||||||
deploy-directory get [
|
|
||||||
dup deploy-config [
|
|
||||||
bundle-name dup exists? [ delete-tree ] [ drop ] if
|
bundle-name dup exists? [ delete-tree ] [ drop ] if
|
||||||
[ bundle-name create-app-dir ] keep
|
[ bundle-name create-app-dir ] keep
|
||||||
[ bundle-name deploy.app-image-name ] keep
|
[ bundle-name deploy.app-image-name ] keep
|
||||||
|
@ -91,9 +81,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
|
open-directory-after-deploy? get [ bundle-name open-file ] when ;
|
||||||
] with-variables
|
|
||||||
] with-directory ;
|
|
||||||
|
|
||||||
: deploy-app-bundle? ( vocab -- ? )
|
: deploy-app-bundle? ( vocab -- ? )
|
||||||
deploy-config [ deploy-console? get not deploy-ui? get or ] with-variables ;
|
deploy-config [ deploy-console? get not deploy-ui? get or ] with-variables ;
|
||||||
|
|
|
@ -1,36 +1,26 @@
|
||||||
! Copyright (C) 2008 James Cash
|
! Copyright (C) 2008 James Cash
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: io io.backend io.directories io.files.info.unix
|
USING: combinators io.backend io.directories io.files.info.unix
|
||||||
io.pathnames kernel namespaces sequences system
|
io.pathnames kernel namespaces system tools.deploy.backend
|
||||||
tools.deploy.backend tools.deploy.config
|
tools.deploy.config tools.deploy.config.editor webbrowser ;
|
||||||
tools.deploy.config.editor webbrowser ;
|
|
||||||
IN: tools.deploy.unix
|
IN: tools.deploy.unix
|
||||||
|
|
||||||
: create-app-dir ( vocab bundle-name -- vm )
|
: create-app-dir ( vocab bundle-name -- vm-path )
|
||||||
copy-vm
|
copy-vm dup 0o755 set-file-permissions ;
|
||||||
dup 0o755 set-file-permissions ;
|
|
||||||
|
|
||||||
: bundle-name ( -- str )
|
|
||||||
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-name get
|
||||||
dup deploy-config [
|
{
|
||||||
[ bundle-name create-app-dir ] keep
|
[ create-app-dir ]
|
||||||
[ deployed-image-name ] keep
|
[ drop deployed-image-name ]
|
||||||
namespace make-deploy-image-executable
|
[ drop namespace make-deploy-image-executable ]
|
||||||
bundle-name "" [ copy-resources ] [ copy-libraries ] 3bi
|
[ nip "" [ copy-resources ] [ copy-libraries ] 3bi ]
|
||||||
bundle-name normalize-path "Binary deployed to " "." surround print
|
[ nip open-directory-after-deploy? get [ open-file ] [ drop ] if ]
|
||||||
bundle-name ?open-file
|
} 2cleave ;
|
||||||
] with-variables
|
|
||||||
] with-directory ;
|
|
||||||
|
|
||||||
M: unix deploy-path
|
M: unix deploy-path
|
||||||
deploy-directory get [
|
deploy-directory get [
|
||||||
dup deploy-config [
|
dup deploy-config [
|
||||||
bundle-name swap append-path normalize-path
|
deploy-name get swap append-path normalize-path
|
||||||
] with-variables
|
] with-variables
|
||||||
] with-directory ;
|
] with-directory ;
|
||||||
|
|
|
@ -5,7 +5,7 @@ io.encodings.binary io.files io.files.windows io.pathnames
|
||||||
kernel locals namespaces splitting sequences system
|
kernel locals namespaces splitting sequences system
|
||||||
tools.deploy.backend tools.deploy.config
|
tools.deploy.backend tools.deploy.config
|
||||||
tools.deploy.config.editor tools.deploy.windows.ico
|
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
|
IN: tools.deploy.windows
|
||||||
|
|
||||||
CONSTANT: app-icon-resource-id "APPICON"
|
CONSTANT: app-icon-resource-id "APPICON"
|
||||||
|
@ -18,13 +18,6 @@ CONSTANT: app-icon-resource-id "APPICON"
|
||||||
: create-exe-dir ( vocab bundle-name -- vm-path )
|
: create-exe-dir ( vocab bundle-name -- vm-path )
|
||||||
deploy-console? get ".com" ".exe" ? copy-vm ;
|
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-windows-icon-path ( vocab -- string )
|
||||||
vocab-dir "icon.ico" append-path ;
|
vocab-dir "icon.ico" append-path ;
|
||||||
|
|
||||||
|
@ -34,8 +27,6 @@ CONSTANT: app-icon-resource-id "APPICON"
|
||||||
[ 2drop ] if ;
|
[ 2drop ] if ;
|
||||||
|
|
||||||
M: windows deploy*
|
M: windows deploy*
|
||||||
deploy-directory get [
|
|
||||||
dup deploy-config [
|
|
||||||
deploy-name get
|
deploy-name get
|
||||||
{
|
{
|
||||||
[ create-exe-dir dup ]
|
[ create-exe-dir dup ]
|
||||||
|
@ -43,10 +34,8 @@ M: windows deploy*
|
||||||
[ drop deployed-image-name ]
|
[ drop deployed-image-name ]
|
||||||
[ drop namespace make-deploy-image-executable ]
|
[ drop namespace make-deploy-image-executable ]
|
||||||
[ nip "resource:" [ copy-resources ] [ copy-libraries ] 3bi ]
|
[ nip "resource:" [ copy-resources ] [ copy-libraries ] 3bi ]
|
||||||
[ nip ?open-in-explorer ]
|
[ nip open-directory-after-deploy? get [ open-file ] [ drop ] if ]
|
||||||
} 2cleave
|
} 2cleave ;
|
||||||
] with-variables
|
|
||||||
] with-directory ;
|
|
||||||
|
|
||||||
M: windows deploy-path
|
M: windows deploy-path
|
||||||
deploy-directory get [
|
deploy-directory get [
|
||||||
|
|
Loading…
Reference in New Issue