factor/extra/builder/release/upload/upload.factor

55 lines
1.2 KiB
Factor
Raw Normal View History

2008-04-12 05:10:04 -04:00
2008-09-10 23:11:40 -04:00
USING: kernel namespaces make sequences arrays io io.files
2008-04-12 05:10:04 -04:00
builder.util
builder.common
builder.release.archive ;
IN: builder.release.upload
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SYMBOL: upload-host
SYMBOL: upload-username
SYMBOL: upload-directory
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-04-12 05:10:04 -04:00
: 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 ;
2008-04-12 05:10:04 -04:00
: rename-temp-file ( -- )
rename-command [ "Error renaming binary on factorcode" print ] run-or-bail ;
2008-04-12 05:10:04 -04:00
: upload ( -- )
upload-to-factorcode get
[ upload-temp-file rename-temp-file ]
2008-04-12 05:10:04 -04:00
when ;