Yowza. Due to some devine intervention I am now responsible to upgrade three rails sites. I started developing them in 2009, but haven’t touched then since mid 2010. The persons who took over have not kept it up to date, nor (from their code) were they really good ruby programmers :)
So I have the daunting task to bring those projects into the present :)
Remember, 2010, rails 2.3.5? That seems like ages ago :) There was
- no bundler
- no rvm (actually, still isn’t since they deploy on windows –aaaaarggh since then I develop on ubuntu and mac)
vendor/pluginsinstead of gems
- no asset pipeline
- old routes
At first I couldn’t even get the correct set of gems together to get the rails site running correctly.
So the steps I took to get it running (on my mac first) :
- create a new branch
- use rvm to switch to start using 1.8.7 and a new empty gemset
gem install rails(which apparently installs the correct 2.3.5 version by itself –impressed :)
- my current rake version is not compatible, luckily if you type
rake _0.8.7_instead of the normal
rakeit will work. Hehe.
- to get to use
rails_upgradeyou have to have a working rails site, so I had to collect all gems in the correct versions
rails_upgradeplugin to check/and upgrade routes/gems/…
- the routes generated where correct
- the gemfile I had to edit manually (the used gems were not specified in the
- also the generated
application.rbneeded to be edited (we added a lot of initializer code there –> should move to an initializer!)
Then I switched (with rvm) to ruby 1.9.3 and ran
Then I created a fresh 3.2.13 project and copied:
config/environments/*.rb(make sure to check and keep any changes you made)
Then I was good to go!!
We still have a lot of
vendor/plugins I need to convert, one in particular I need to convert to an engine (gem).
Things I still need to do:
- convert engine to gem
- convert others to
- move assets to asset pipeline
And then I should have a running webapplication again. Wow.
Of course: the sites have no tests at all (my bad as well: when I started rails I did not know about testing), so will have to still add those. Starting with cucumber first, and add rspec later, when I touch the code (working from the outside in).