Simple web project file management.
Posted by postfuturist on 2009-03-08 14:34:40

I have noticed when working on my own projects outside of work I tend to put files haphazardly in various folder in my home directory. Now that I am starting to work on web related projects, I needed to come up with a sane system for file management. This is an outline of how I did it. Your mileage may vary.

Start with a main projects folder, doesn't matter what you call it, but all your projects will go in here. I'll call mine /home/steve/projects, or ~/projects in shorthand. This folder is put under subversion revision control on my shared hosting account. It is a self-contained repository that contains server deployment scripts, project files and everything else I need. Read on/

I have a project called 'test' so that appears in the ~/projects/test folder. In the ~/project folder I have the deploy script 'update_test.sh' which looks like this:

#!/bin/bash
rsync -avCz --delete test/ username@myserver.com:/home/username/test.myserver.com/

This rsync command has the -C option which ignores .svn and CVS folders. It also has the --delete option which deletes files on the target folder that don't exist in the source folder. The other are standard: -a for archive mode, -z for compression, and -v to make the output show you what is going on. Also, when devising your rsync deploy command it is wise to add the --dry-run command which, when coupled with -v, will show you how the files would be updated without actually changing anything. Rsync is a powerful command which can cause a lot of damage, especially with the --delete option activated.

Right now, I am using Netbeans 6.7 M2 as an IDE. It has has excellent PHP / HTML support. When I create the netbeans project, I tell netbeans to put the metadata in a separate folder. I created a folder called ~/project/netbeans to hold all Netbeans project files. This way the project files are kept under subversion control like everything else but are not included in the server deploy.


blog comments powered by Disqus