tags:

views:

35

answers:

2

I am currently writing a CGI script that I store in a subversion tree built on a remote machine. There are a bunch of other related files on the subversion tree, but only a few CGI scripts. I currently edit the script with TRAMP and then have to manually cp it to the cgi-bin directory when it's ready for testing (which includes opening the CGI link in a browser).

How can I best automate this process? I'm half considering a small Makefile that can be kicked off by Emacs. I'm also considering an Emacs macro since Emacs is running locally it could probably actually open a new Firefox tab for me after pushing the file.

A: 

For development, you should edit your cgi script directly in the cgi-bin directory. Keep your firefox opened on the url of your script, then do C-r to reload the page.

Jérôme Radix
And how would I keep the cgi-bin directory in sync with Subversion? I have a bunch of non-cgi files in my svn tree, so a check-out gets quite ugly in the cgi-bin. Another option isto copy the file back to the svn tree..basically the same problem I have now (edit/copy/deploy).
User1
+1  A: 

I am using execute-buffer-script to execute scripts residing at the other end of a tramp connection in emacs. This does not work with cgi scripts, as they may need the extra information that the browser/webserver combination provides.

You could softlink your svn controlled cgi-bin to the location the web server expects or simply softlink each individual file.

cd /path/to/webservers/cgi-bin
ln -s /path/to/svn/controlled/cgi-bin/individual-file.ext individual-file.ext

Then point your tramp connection to either the file or the link and start modifying. Reload in the browser when you feel you have something that works, rinse, repeat. With most cgi programming (jsp included) this gives a very fast and interactive development process.

klang