Upgrading Doodlekit to Rails 1.2.3 - Torture Hell Ride
I’ve been putting it off for a while, but I finally got around to upgrading Doodlekit to Rails 1.2.3. I planned on documenting the upgrade, so that I could post it here and possibly help some people out. However, it turned into such a shitstorm, I had to just go monk and get it done.
Here are some highlights.
1. My main problem was with engines. Doodlekit has become so huge that I implement the Addons as engines to help keep things manageable. I had a lot of weird errors at the beginning, and I finally figured out it was because of the changes in the way engines work. Apparently a lot of the engine code has been sucked up into rails core, and the actual engines implementation is pretty light.
At first I upgraded the engines plugin using script/plugin, but after getting more errors I finally just deleted the engines dir, and installed it fresh. That cleared up most of my problems.
2. There were a lot of places where I was auto-loading classes that I need to manually require. In this case it was just a matter of running the tests and finding each one. Not too bad.
3. Form tags. Friggin frackin form tags! When I finally got my tests to actually run, all I could see were deprecation warnings. Most of them were pretty easy fixes, however I wish I would have counted how many form tags I had to fix. I couldn’t stand all the warnings, so I buckled down and replaced all the start and end_form_tag’s with the new sexier block method. This did give me a chance to clean up some other things that were bothering me. I mean as long as I was touching every view in my codebase.
4. I finally got all my tests running cleanly, and did a manual walk through. Not so fast Billy Ray. My routing wasn’t working at all. See in order to support the multi-site environment locally, I use a subdirectory context, like http://localhost:3000/default/blog, http://localhost:3000/garbageburrito/blog. I have a special routing for development mode that pulls that directory name out. However Rails new routing system didn’t seem to like that at all.
I figured it would be a lot of trouble to get that all running properly, so I just scrapped it. Now I can test a single site without any special setup, and I can test multi-site by adding sub-domains to my hosts file. I might try something slicker down the road, but I’m tired now.
5. I did the walkthrough, found a few bugs here and there, and was ready for deployment. At first I just did a normal rails upgrade through gem, and cap’d it. Mongrel wouldn’t start cause it couldn’t find ‘gem’. So after some frustration I figured out I needed to upgrade rubygems from 0.8.11 to 0.9.2. I tried ‘gem install rubygems-update’ first, but ‘gem –v’ still came up with the old version. After some digging I found out I needed ‘gem update –system’, which did the trick.
However it still gave me the require_gem deprecation warning. I figured this was cause I still had ruby 1.8.4. For some reason yum couldn’t find the latest version of ruby, so I compiled it from source, removed it from yum, and re-installed all the gems.
Running swimmingly now.
Like I said, I hoped that would have been more instructional than narrative, but it just wasn’t that clean. Please oh please don’t make me go through this for 2.0.