Previously
At work we have an old internal Rails application that was in need of some love. As I noted in that previous post, the Ruby version that is running through Passenger for this project is 1.8.6, which was end-of-lifed long ago, and I decided to update it one minor revision to 1.8.7. Although this version will soon hit its own end of life, it is largely backwards compatible with 1.8.6. To whit: A quick search around StackOverflow led to this question, which links to a list of incompatibilities between the two. Ah, documented differences! I wonder if anything else will show…
Incompatibilities
This app has some schedule data in it, so the Date.parse
and String#slice!
changes listed would potentially affect the application. Thus I needed to
search for uses in the code:
find . | grep \.rb | xargs grep "Date.parse"
30 lines in 6 files, most of which are already using the new syntax. But with the reference to the occurances, I then knew where in the code to test once the Ruby update had been completed.
I ran a similar search on the slice!
changes, but found nowhere where the
incompatibility would have an effect.
Tests?
It’s important to note here that we don’t have any tests written against this application. This means that as I’m making large changes to the underlying technology, I’m likely to miss subtle effects, especially on parts of the application that aren’t exercised very often.
To cope with this, I installed New Relic on the staging box, which does a great job of surfacing errors and application behaviour.
Upgrade
With that in place, getting the new Ruby running was relatively simple. Using RVM, I installed 1.8.7 on a staging box, then re-installed the Passenger gem and updated httpd.conf to use the new Ruby.
Then, it was a matter of manual testing, clicking around the
application and ensuring that the behaviour was consistant. During this
phase, I paid particular attention to the areas where the Date.parse
calls were made, as highlighted above.
I didn’t find anything that needed changing, and the New Relic dashboard was similarly quiet, so the Ruby upgrade was set to go.