We have an internal Rails application used at work which had fallen a bit behind the times. In the first step in bringing it together, I migrated it from Ruby 1.8.6 to 1.8.7, with a little bit of pain. Next up: Rails.
To recap, the plan here was to move the Rails gems from 2.3.4 up to the latest patched version of 2.3. Again, we have no tests written around this application (I’m bringing it up a lot, to remind myself how useful it would have been), so all these changes have to be tested by hand. I spent some time poking around to see if I could find changelogs for each of the releases, to get a feeling for what sort of changes I should be looking for. The best thing I found was Github’s compare view, but there are too many changes to track with an individual view this way:
Instead, I found some recent release notes (as an example) and noted what I should look for there: UTF-8 changes and some ERB edits in the main.
Staging the Changes
Having poked around our ERB templates to see if anything was going to obviously break, I started updating the code on our staging server.
First, I updated Rails.
gem install rails -v2.3.15 No problem!
Uh oh, Rake aborted.
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead. ./Rakefile:8 ~/.rvm/gems/ree-1.8.7-2012.02@app/bin/ruby_noexec_wrapper:14 (See full trace by running task with --trace)
There were a few things here. The first was looking at the gemlist,
rake (10.0.3, 0.8.3): 10 is a much newer version, and
isn’t one I conciously installted. I think it might have been added by
RVM. Trying to uninstall it was useless
gem uninstall rake -v10.0.3
yielded a ‘rake could not be found’ error.
The problem was that this was sitting the the global gemset
for the ruby I was using. I switched
rvm use ree@global, uninstalled
gem uninstall rake -v10.0.3, and then swiched back to the app
rvm use ree@app. This worked, although the deprecation warning
was still in place. To fix that, I installed RDoc, and then edited the
Rakefile to replace rake/rdoctask with rdoc/task.
Alright, let’s do this again:
DEPRECATION WARNING: Rake tasks in vendor/plugins/pluginname/tasks and vendor/plugins/juggernaut/tasks are deprecated. Use lib/tasks instead. (called from ~/.rvm/gems/ree-1.8.7-2012.02@app/gems/rails-2.3.15/lib/tasks/rails.rb:10)
So – the update ran, and with it some changes to
boot.rb and some of
set up to Rails’ expectations, and the vendor plugins layout has changed.
However, moving to
<project>/lib/tasks removed the
deprecation warning on the next rake run
End-to-end testing the site didn’t reveal any show stopping issues, so I set it up on a staging environment for everyone else to hit at.
Once that was done (with no errors), we deployed the changes to the live server.