How to keep your project in a Subversion source repository.
1. First if you don’t have Subversion installed, here are the instructions to get Subversion: Installing Subversion
2. Create the Subversion repository:
svnadmin create /usr/local/svn/repos3. Suppose your project is going to be called “depot”.
Create the basic directory structure recommended for use with Subversion:
4. Do the initial import of this directory structure:
svn import /my/homedir/depot file:///usr/local/svn/repos/depot -m “initial import”Note all paths above needed to be absolute, you can’t specify just “depot”.
[Also, users of the file: scheme on Windows platforms will need to use an unofficially “standard” syntax for accessing repositories that are on the same machine, but on a different drive than the client’s current working drive. The following URL path syntax will work where X is the drive on which the repository resides:
svn import /my/homedir/depot file:///X:/path/to/svn/repos/depot -m “initial import”
5. Now that subversion knows about this directory structure for your project, you can get rid of it:
rm -r /my/homedir/depot6. Now check out a local working copy of your project:
cd /my/homedir svn checkout file:///usr/local/svn/repos/depot/trunk depotHere you specify that you want to checkout the main “trunk” directory of your project “repos/depot/trunk” into a local directory “depot” where you will be doing your development.
7. Now you can create your Rails app:
rails depotRails will simply create the files for your project into the existing depot
directory.
8. Now that all the files for your project are in place, lets add all of them
to the repository:
9. Now lets tell subversion not to keep track of our log files and ignore them in the future:
svn propset svn:ignore “*” log/svn commit -m “removing log files and ignoring them in the future”
svn up
You may also want to ignore your database.yml file.
If you’re using Lighttpd you may need to ignore its configuration files.
Credit to Garrett Murray
for the original article on which this is based . This one is modified to reflect how you would store multiple rails projects in an svn repository.
For those using Mac OS X, svnX is a wonderful GUI alternative to the CLI commands presented here. You can find it here.