DAVID RICE

Software Developer

+44 (0) 7590 538 303

21 Ormeau Avenue
Belfast, Northern Ireland
BT2 8HD

Version controlling your shiny new ruby on rails application

17 May 2006 {View Comments}

I posted this article some time ago but thought i’d give a little update as some things have changed since Ruby on Rails version 1.1

  1. Okay first of all lets assume we’ve created a new project rails example

  2. Now cd svnexample and we’ll import the app into our repository svn import . http://domain.com/svn/example/trunk

  3. mv example example_old

  4. svn co http://domain.com/svn/example example We now have a working copy of our application

  5. The following step will be the same for all of your rails 1.1 > ? applications, so it’s a good idea to extract it into a handy little shellscript you can run time and time again

     svn remove log/*
     svn commit -m 'removing all log files from subversion'
     svn propset svn:ignore "*.log" log/
     svn update log/
     svn commit -m 'Ignoring all files in /log/ ending in .log'
     svn remove tmp/*
     svn commit -m 'removing all cache sockets and sessions from tmp directory' 
     svn propset svn:ignore "*" tmp/
     svn update tmp/
     svn commit -m "Ignoring all files created in tmp directory"
     
     # if you're doing a collaborative application you'll want to ignore 
     # database.yml too so do these steps
    
     svn move config/database.yml config/database.example
     svn commit -m 'Moving database.yml to database.example'
     svn propset svn:ignore "database.yml" config/
     svn update config/
     svn commit -m 'Ignoring database.yml'

    that will clear out all of the cruft we don’t want to have to transfer every time we do a commit, especially if your using lighttpd locally as subversion really hates the fcgi-socket-0 files.

And that’s about it, if you want to streamline things a bit more make an alias for your shellscript and run it every time you first checkout your new rails app. If you want more information there’s a lot of stuff over at the ruby on rails wiki

«