Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] Quanta and Automatic Upload After Save
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
bigredgiant1
n00b
n00b


Joined: 23 Dec 2003
Posts: 62

PostPosted: Sun Jan 02, 2005 1:26 pm    Post subject: [HOWTO] Quanta and Automatic Upload After Save Reply with quote

Hi. Recently I ran into a little issue. For the longest time I've thought that linux was missing an editor/IDE with the feature of automatically uploading a file after it was saved in the editor. Quanta has an FTP project type, which doesn't use a local workspace, and just uploads everything directly; this would work for me except that it disables Cervisia integration, because Cervisia cannot work with remote workspaces. After much research I've determined that the feature does not directly exist for any editor/IDE currently for linux (although a quick upload feature IS in the CVS HEAD for Quanta, but I'm impatient.) Ok, so here's how to get this feature working in Quanta 3.3.2.


  1. Open up your favorite editor, and save the following script somewhere. Remember the location, you will need it in a minute.
    Code:
    #!/bin/sh
    # This script uses the parameters given by Quanta to upload the file
    # currently being edited in quanta.

    LOCAL_DIR=`dirname $4`
    REMOTE_HOST=mydomain.com
    REMOTE_USER=myusername
    REMOTE_PASS=mypassword
    REMOTE_DIR=relative/path/to/workspace/${LOCAL_DIR}

    echo -n "Uploading ${4}... "
    `ncftpput -u ${REMOTE_USER} -p ${REMOTE_PASS} ${REMOTE_HOST} ${REMOTE_DIR} ${4} &>/dev/null` && echo "OK" || echo "FAILED"

  2. Change the hostname, username, and password. Replace "relative/path/to/workspace/" with the path that you'd change to if you logged into your server with an FTP client and needed to browse to your workspace.
  3. Save the script, and make it executable:
    Code:
    chmod 744 /path/to/your/script

  4. Open up Quanta and create a new local project.
  5. Goto Settings | Configure Actions, and click New Action.
  6. Select the Script Type, and next to Text enter in the name for this new action (I made mine AutoUpload).
  7. Add a shortcut key if you wish.
  8. Under detailed settings, enter in the path to your script, a space, and %userarguments, like so:
    Code:
    /home/username/myproject/upload.sh %userarguments

  9. For Input select None, and for Output and Error select Message Window.
  10. Click Apply.
  11. Once back in the main Quanta window, goto Project | Project Properties, and click on the Event Configuration tab.
  12. Click Add. Set Event to "After Document Save", Action to "Script Action", and Action Name to whatever name you gave the Action you just made in step 6.
  13. Click OK.
  14. Click OK.


You should now be all set to automatically upload files assuming you configured everything properly. This whole process, once finished, really gives a seamless upload integration. The output (success or fail) of the script is shown in the message window (mine originally took up 80% of the window, I resized it down and made it not overlap). Also note that for each project I develop in Quanta that requires this feature, I just give it its own script and Quanta action.

If you have any questions or comments please reply. I hope this helps you. Best of luck.
_________________
Vic @ Shellsage
Dual Opteron 242 -- AMD64 2.6.16 Development Sources
CFLAGS="-march=k8 -O3 -pipe" MAKEOPTS="-j3"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum