Quickly Setup New Projects Using SVN

We have a standard directory structure for each of our projects:

CODE:
  1. projectname
  2. /docs
  3. /testing
  4. /build
  5. /priv
  6. /pub

Testing contains our Selenium scripts (and in the future - unit testing scripts). Build contains our Ant scripts.

At the office I'm in charge of setting up new SVN repositories and one of the things I've done to speed up setting up new projects is to create a 'template' project directory. This contains all the folders listed above along with some default buildfile and testing scripts.

I first created this layout in a new repository. I then added our standard buildfiles and testing suite files. I then created a SVN dumpfile using the svnadmin dump command. You end up with a dumpfile containing the contents of your repository.

Now when I create a new project I simple create the new project's repository, and then use the svnadmin load command to import my 'default' dumpfile contents.

CODE:
  1. /usr/bin/svnadmin create --fs-type fsfs /var/www/svn/projectname
  2. sudo chown -R apache:apache /var/www/svn/projectname
  3. sudo svnadmin load /var/www/svn/projectname </var/www/svn/tmp/template.dumpfile --ignore-uuid -q

Now when the first person checks out the project - they already have the required directory structure, buildfiles and testing templates.

3 Comments

  1. Posted April 7, 2008 at 2:25 pm | Permalink

    It’s always funny to read your posts about the same technologies I use. Seems our methods are almost always the same or nearly so. In my case I have one repository with multiple project directories. One of those projects is named “.template” (so that it appears at the top of any listing and to denote its status as a non-active- or hidden - project). When I need a new project, I just copy the contents of .template:

    svn cp -m “Copying base structure from the template” .template mynewproject

    I also keep a lot of core directories and files (e.g. build.xml.sample, _global.css) in my template. As long as I keep the template project up to date, any new projects will always get the latest. It’s a very convenient system.

  2. Posted April 7, 2008 at 2:31 pm | Permalink

    @Rob - Hopefully we’re doing it the right way :)

    Your system sounds very similar - and much easier in your one repo/multi-project environment. At some point I need to build a little script so I can just go ‘create projectname’ and it’ll run everything for me…

  3. Posted April 7, 2008 at 2:35 pm | Permalink

    I worked with my sys admin to do just that. The script creates the new environment, scripts out a new Trac project (with permissions set) and links the two. Quick and easy. Can’t beat that, right? :-)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

Comments for this post will be closed on 5 August 2008.

Creative Commons License

Copyright © 2007 thecrumb.com. All rights reserved.