Setup a Rails Project in Subversion

First, create the directory out of which you’ll be running your project. Ultimately, this is going to be the repository:


mkdir project_name

Next, change into that directory and then add the branches and tags directories:


mkdir tags

mkdir branches

After that, create your Rails project in the same directory naming it whatever you’d like. Once it’s created, move it to the trunk:


rails new acme

mv acme trunk

At this point, the repository is practically setup; however, there’s some minor modification to configuration files that need to be done. Otherwise, Rails will prefix the name “trunk” in the files rather than the actual project’s name.

First, remove all files in the tmp and log directories:


cd trunk

rm -f tmp/*

rm -f log/*

Next, rename the default database configuration file:


cd config

mv database.yml database_example.yml

Using your favorite client (be it the command line or something else), add everything into the repository. Once done, copy the database example back:


copy database_example.yml database.yml

And finally, Subversion needs to ignore certain files and directories in the project.

Specifically:

  • database.yml
  • log/*
  • tmp/*

Instructions for how to configure this will vary on which client you use.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.