Language modules for Visual Studio Code

Richard Gaskin ambassador at fourthworld.com
Thu Apr 21 10:16:58 EDT 2016


Sannyasin Brahmanathaswami wrote:

 >  I do a lot of server script editing directly via my FTP client…
 > remote editing. I know yeah, some of you wizard have those scripts
 > working via a stack that allows you to edit in the script editor…
 > someday one of you will write a plug in for the rest of us…

I haven't yet generalized my uploader, though I might some day because I 
use variants of it on most of my projects lately, so many of them being 
client-server systems.

One of the reasons I haven't generalized them is that they're easy 
enough to write as a one-off.

Here's the one I use for updating LiveNet (the downloadable stack 
available in the IDE formerly known as RevNet) - note that scp is able 
to securely transfer the file without stopping for a password prompt 
because I have my local machine's public SSH key shared with that 
server, something we're all doing with our servers anyway for both 
security and convenience, aren't we?:

on mouseUp
   set cursor to watch
   -- Make compressed copy of stack file:
   set the itemdel to "/"
   put the filename of stack "LiveNet" into tFile
   put tFile &".gz" into tGZFile
   put compress(url ("binfile:"& tFile)) into \
         url ("binfile:"& tGZFile)
   -- Post to URL:
   put "scp  "&quote& tGZFile &quote& \
      " user at domain.com:~/public_html/livenet" &
      "/LiveNet.livecode.gz" into tCmd
   put shell(tCmd)  into tResult
   if  tResult is not empty then
     put tResult
   else
     put "Uploaded successfully!"
   end if
end mouseUp

Note that the first half of that is just making the compressed copy of 
the stack for upload.  I like to do that because it shortens transfer 
times, but without that it's an even simpler handler, just building the 
syntax for scp which is pretty straightforward, using the same 
Source-then-Destination syntax we see in revCopyFile and many other file 
moving commands:

   scp  <pathtolocalfile>  <user>@<host>:<pathtoserverfile>

You can also switch that around to download, or even move files from one 
remote machine to another.

You write an uploader once and put it in your Plugins folder, and then 
anytime you need to update your server an automated secure upload is 
just one click away.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com





More information about the use-livecode mailing list