Updating Rails when vendor/rails is under local svn

In some of my projects I have Rails checked out in vendor/rails and I keep it under local subversion repository (not as an external nor ignored). Why? It is sometimes to handy to have just whole application in one repository.

The only problem I encountered is when I need to upgrade Rails version. Normal rake rails:unfreeze && rake rails:freeze:edge TAG=rel_x-y-z is not solution, since unfreeze just deletes vendor/rails along with svn metadata and importing Rails source every upgrade makes Your repository grow. Sure upgrades are not so often, but when lifespan of project is over a year…

Besides, deleting makes svn client refuse to work ;) maybe someone with high svn-fu knowledge would make it, but I use just this simple procedure. Let’s assume I’m upgrading from 1.2.3 to 1.2.5:

cd vendor/rails
rm -f TAG_rel_1-2-3
for i in *; do
  svn export  --force http://svn.rubyonrails.org/rails/tags/rel_1-2-5/$i
done
touch TAG_rel_1-2-5
rake svn COMMIT_MSG='new rails version'

The last command is using this simple rake task to import all changes to SVN. Code from above is bash command line and was tested on FreeBSD. And in case new version of Rails adds new directories, this way You won’t fetch them.

Leave a comment

Your email address will not be published. Required fields are marked *

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