How To Pimp Your Local Rails Setup
So after reading Mike Clark’s Managing Rails Versions With Capistrano, I completely switched how I use rails locally as well. I try to stay as close to the edge of Rails as possible because I’m addicted to new.
Formerly, I would rake rails:freeze:edge into my apps and even in my svn repositories. Yes, I know of svn:externals but for some reason I just didn’t like updating rails in that way. Freezing rails into your repository makes it a PAIN to update to a new revision. Each time some cool new feature came out, I had to svn rm vendor/rails and then svn commit and then rake rails:freeze:edge and then svnaddall (my alias for adding all the non version controlled files into version control) and then svn commit again. Inevitably, something would go wrong during that process and I would spend half an hour on it.
The other kicker is that I had to do this for each of my apps. After reading Mike’s article it struck me that I could do the same thing on my local machine that he is doing for remote versions. Here are the commands that I use to setup each of my macs (this is kind of from memory, but hopefully you catch my drift).
First, create a rails directory in your user folder and checkout rails trunk inside it:
$ mkdir ~/rails $ cd ~/rails $ svn co http://dev.rubyonrails.com/svn/rails/trunk .
Now cd into your app and setup a symlink to the trunk folder you just created in your vendor folder:
$ cd ~/Sites/myrailsapp $ ln -s ~/rails/trunk vendor/rails
If you are using subversion, you can ignore the symlink so it doens’t try to version it:
$ svn propset svn:ignore "rails" vendor/ $ svn commit -m "using new sweet rails setup" $ svn up
After that, your rails app will be running on the freshest version of rails and is fully ignoring rails in subversion. Now, when you see a changeset come through (you are watching the changesets aren’t you), all you have to do to update your app and any others that you are running like this is:
cd ~/rails/trunk && svn up
Or, if you don’t want to have all your apps running on edge, you can checkout a specific revision to your rails folder and link to that like so:
$ cd ~/rails $ svn co -r 6000 http://dev.rubyonrails.org/svn/rails/trunk Rev_6000 $ cd ~/Sites/myrailsapp $ ln -s ~/rails/Rev_6000 vendor/rails
You can then update to a new revision by following the steps above and then doing:
$ cd ~/Sites/myrailsapp $ rm -f vendor/rails $ ln -s ~/rails/Rev_6001 vendor/rails
I’ve been using this setup for a few weeks and am loving it (especially, with the flurry of activity of late).