Two of my side projects, shapewiki and hotspotr are now running in production on Ruby 1.9.1. There are some good resources out there for getting familiar with Ruby 1.9. I wanted to share a few tips/observations on the upgrade process.
Gem/plugin compatibility: not really an issue on the two projects I deployed. Obviously, your experience will be a case-by-case depending on the gems/plugins you use. My takeaway was that the apprehension of dealing with this was far worse than actually dealing with it. The worst case was having to seek out a newer version (acts_as_versioned) or swapping in an alternative (nokogiri). Some of the gems/plugins I dealt with were:
acts_as_versioned: ok, I had a pretty old version and updated it to:
hpricot: seemed ok until I ran into run-time issues, had to switch to nokogiri. Which turned out to be very easy, essentially no code changes. Note: I did this part six months ago, and haven't checked hpricot since, so it may be fine now.
Local development environment: there's just one thing you need to know: RVM. RVM makes it incredibly easy to install 1.9 and switch back and forth frictionlessly. And if you're concerned about messing up your working-just-right current system, don't be: you can revert back to your original setup in one command, or remove all traces of RVM whenever you want to. But trust me, you won't want to. RVM is awesome. Install it now so you can start doing the right thing.
Character encoding issues: this is what kept me off of 1.9 for quite a while. I initially got a few applications running on 1.9 six months ago, but ran into problems in production with extended characters from existing production data. Here are the fixes that finally got me up and running: http://gist.github.com/273741. Just drop this into your Rails app as
confit/initializers/ruby_191_hacks.rb and you should be good as long as your database content is stored as UTF-8.
Ruby 1.9.1 in production: I took the shortcut of just using RVM to install Ruby 1.9 in production as well. A dedicated installation probably makes sense in the future, but the RVM installation works fine for now.
I feel strongly that building & maintaining momentum on Ruby 1.9 is important for the Ruby and Rails communities. The important thing to know is that it's not hard. RVM makes it very easy to dip your toes. Gem and plugin compatibility is very good at this point, and getting better all the time. So go ahead, install RVM and start the process. Once you've upgraded your app or got a new gem working on 1.9, put up a quick post or tweet on it. Every bit helps us move forward as a community!
UPDATE: this issue turned out to be part of a larger issue with a failing logic board on my macbook pro. RubyMine continues to be an awesome IDE for Rails development.
RubyMine is a pretty sweet IDE. I've been using it for a few versions now, including the current 2.0 beta.
However, I hit snag when I upgraded my Mac to Snow Leopard this weekend -- RubyMine was showing gibberish for any file I opened. Apparently, RubyMine is trying to use a font which doesn't exist on my upgraded Snow Leopard system. A quick fix is to go into RubyMine's preferences->fonts:
And change it to another monospaced font of your choosing. Hope this helps someone who encounters the same issue.
Charles Quinn sent me this link, and I immediately installed it: git_remote_branch. It provides nice shortcuts for dealing with remote branches. Examples:
$ grb create branch_name [origin_server]
Create a new local branch as well as a corresponding remote branch based on the branch you currently have checked out. Track the new remote branch. Checkout the new branch.
$ grb publish branch_name [origin_server]
Publish an existing local branch to the remote server. Set up the local branch to track the new remote branch.
And an additional nice touch: grb "prints all commands it runs on your behalf in red, so you eventually learn them." Nice! The link again: git_remote_branch.
More on this soon. All I can say for now is:
Completed in 3368ms (View: 2256, DB: 8) | 200 OK [http://hotspotr.com/wifi/list/14-austin-tx] Completed in 3668ms (View: 2420, DB: 8) | 200 OK [http://hotspotr.com/wifi/list/14-austin-tx] Completed in 3312ms (View: 1964, DB: 12) | 200 OK [http://hotspotr.com/wifi/list/14-austin-tx] Completed in 3296ms (View: 1896, DB: 8) | 200 OK [http://hotspotr.com/wifi/list/14-austin-tx]
Completed in 989ms (View: 593, DB: 7) | 200 OK [http://hotspotr.com/wifi/list/14-austin-tx] Completed in 1035ms (View: 591, DB: 6) | 200 OK [http://hotspotr.com/wifi/list/14-austin-tx] Completed in 1055ms (View: 588, DB: 7) | 200 OK [http://hotspotr.com/wifi/list/14-austin-tx] Completed in 985ms (View: 592, DB: 7) | 200 OK [http://hotspotr.com/wifi/list/14-austin-tx]