« Humdrum Ho Hummy | Main | I Always Wondered Where My Brain Actually Is »

Geeky Stuff

I keep all the files for this website in a system called concurrent versioning system (CVS). It's a nifty way of tracking changes to files and keeping old versions around, but hidden so that they don't get in the way.

Now, I've almost found a way to have CVS update the webserver's files when I make changes to the copies on my computer. And it will happen automatically. I'm happy about that.

I've also gone and registered a domain name for my laptop, so that when I go around and use different internet accesses, I can still use the same domain name. And there's nifty software to automatically update the IP address to match the domain name. I'm happy about that.

Now I just wish I could get well again. Stupid cold/flu/crappy thingy. I don't like being sick.

Comments (3)

ben:

I don't like it when you're sick, either. Get better, so we can tango on my birthday. Take that as you will. *duck*

But did you get the CVS thing working. In the past I've tried using CVS to keep my website up to date but I find that it given how often you delete files or rename them.. it's not really a tidy way of organizing a website.

So, how do you work with it?

Perl to the Rescue!

#!/usr/local/bin/perl
use File::Temp qw(tempdir);
my $dir = tempdir(CLEANUP => 1);
my ($cvsroot, $modname, $location) = @ARGV;
system("cd $dir");
system("cvs -d $cvsroot export -D now $modname");
system("cp -R $modname/* $location");

of course you can do a few other things in there too, like have perl use Net::FTP to send the files to you actual webserver (always nice) or you could throw in some template processing (in Perl, of course) or what ever you want. When the script exits, the temp directory is cleaned up.

Then add a line to the file CVSROOT/loginfo (or something, can't remember right now and the server is in the back of a car) that looks like

modulename updatewebsite $CVSROOT modulename location &

where modulename is the name of the module, updatewebsite is the name of the script you wrote above, and location is where you want the stuff copied to. It has to be run in the background because there is a race condition in the locking (you cannot export the module, until after the commit, which involves running the updatewebsite script, which wants to export the module. Running in the background lets the script wait until after the commit completes).

and it's all taken care of for you every time you commit your changes.

About

This page contains a single entry from the blog posted on November 3, 2003 8:58 PM.

The previous post in this blog was Humdrum Ho Hummy.

The next post in this blog is I Always Wondered Where My Brain Actually Is.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33