Update builder.release.upload for robustness; make upload location configurable
parent
33eee7638b
commit
dbd7b4f546
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
USING: kernel namespaces io io.files
|
USING: kernel namespaces sequences arrays io io.files
|
||||||
builder.util
|
builder.util
|
||||||
builder.common
|
builder.common
|
||||||
builder.release.archive ;
|
builder.release.archive ;
|
||||||
|
@ -8,17 +8,47 @@ IN: builder.release.upload
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: remote-location ( -- dest )
|
SYMBOL: upload-host
|
||||||
"factorcode.org:/var/www/factorcode.org/newsite/downloads"
|
|
||||||
platform
|
|
||||||
append-path ;
|
|
||||||
|
|
||||||
: (upload) ( -- )
|
SYMBOL: upload-username
|
||||||
{ "scp" archive-name remote-location } to-strings
|
|
||||||
[ "Error uploading binary to factorcode" print ]
|
SYMBOL: upload-directory
|
||||||
run-or-bail ;
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
: remote-location ( -- dest )
|
||||||
|
upload-directory get platform append ;
|
||||||
|
|
||||||
|
: remote-archive-name ( -- dest )
|
||||||
|
remote-location "/" archive-name 3append ;
|
||||||
|
|
||||||
|
: temp-archive-name ( -- dest )
|
||||||
|
remote-archive-name ".incomplete" append ;
|
||||||
|
|
||||||
|
: upload-command ( -- args )
|
||||||
|
"scp"
|
||||||
|
archive-name
|
||||||
|
[ upload-username get % "@" % upload-host get % ":" % temp-archive-name % ] "" make
|
||||||
|
3array ;
|
||||||
|
|
||||||
|
: rename-command ( -- args )
|
||||||
|
[
|
||||||
|
"ssh" ,
|
||||||
|
upload-host get ,
|
||||||
|
"-l" ,
|
||||||
|
upload-username get ,
|
||||||
|
"mv" ,
|
||||||
|
temp-archive-name ,
|
||||||
|
remote-archive-name ,
|
||||||
|
] { } make ;
|
||||||
|
|
||||||
|
: upload-temp-file ( -- )
|
||||||
|
upload-command [ "Error uploading binary to factorcode" print ] run-or-bail ;
|
||||||
|
|
||||||
|
: rename-temp-file ( -- )
|
||||||
|
rename-command [ "Error renaming binary on factorcode" print ] run-or-bail ;
|
||||||
|
|
||||||
: upload ( -- )
|
: upload ( -- )
|
||||||
upload-to-factorcode get
|
upload-to-factorcode get
|
||||||
[ (upload) ]
|
[ upload-temp-file rename-temp-file ]
|
||||||
when ;
|
when ;
|
||||||
|
|
Loading…
Reference in New Issue