As any sane programmers we keep all our code in a source control system (in our case it is CVS).
We also use a PHP framework called Nova System that we’ve created specially for use in our products. This framework should obviously be shared between the products, so naturally it lives in its own directory in our CVS repository.
So for Stuffed Tracker we actually have 2 top directories (“tracker” and “system”) which we have to retrieve from the CVS when preparing a new release. This imposes additional challenges for us, but nothing that we couldn’t handle.
As soon as a new release of Stuffed Tracker is ready, we tag it with appropriate version in CVS and then launch a special script that I’ve wrote using Perl that not only retrieves tracker’s files, but also Nova System’s files and tracker’s documentation from a separate location. It then puts everything in the appropriate directories (“system” inside “tracker”), removes CVS service directories and then packs everything in a zip file with a correct name containing the product’s version number.
We then only need to upload this file to our server and that’s all.
Today I’ve also added one nifty feature to this script that removes comments (PHP and HTML) in Russian from the source files before packing them in the zip. We’ve decided that it is not appropriate to keep Russian comments in the source code, since most people viewing the source won’t be able to read them anyway.
Comments are removed with a very complex regular expression, that I’ve partially borrowed from an excellent book called “Mastering Regular Expressions” (by Jeffrey Friedl). I recommend this book to anyone who wants to understand how regular expressions work on the very low level.
This book has a great example of a regular expression that removes C and C++ style comments, even keeping them unchanged if they are inside double or single quotes. I’ve added some of my own logic to this regex. Particularly I wanted to remove the comments that start with “#” as well (they are also used in PHP). And I wanted a string like “// ?>” to work correctly, since in PHP “?>” would not be a part of the comment.
Anyway, I’ve made a slightly complex regex from the book REALLY complex and of course it didn’t work when I first tried it. I had a hard time trying to debug it. And then I’ve found an excellent tool just for my situation. It is called Regex Buddy. They don’t have a trial version available, but I’ve looked at Flash demos and was sold immediately.
It really helped me to make by regex work. I can recommend it to anyone writing at least slightly complex regular expression. Great software!


















