bigredgiant1 n00b
Joined: 23 Dec 2003 Posts: 62
|
Posted: Sun Jan 02, 2005 1:26 pm Post subject: [HOWTO] Quanta and Automatic Upload After Save |
|
|
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.
- 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" |
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.
Save the script, and make it executable:
Code: | chmod 744 /path/to/your/script |
Open up Quanta and create a new local project.
Goto Settings | Configure Actions, and click New Action.
Select the Script Type, and next to Text enter in the name for this new action (I made mine AutoUpload).
Add a shortcut key if you wish.
Under detailed settings, enter in the path to your script, a space, and %userarguments, like so:
Code: | /home/username/myproject/upload.sh %userarguments |
For Input select None, and for Output and Error select Message Window.
Click Apply.
Once back in the main Quanta window, goto Project | Project Properties, and click on the Event Configuration tab.
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.
Click OK.
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" |
|