Every time I use MacPorts I seem to need to look up the commands in the MacPorts Guide, which isn't the most user-friendly doc in the world. But eventually I found the commands I wanted:
sudo port selfupgrade
sudo port upgrade outdatedThat ran a while and did (according to 'port installed') update Ruby 1.8.7, which it looked like I already had an older version of. Hm...why was 'ruby -v' showing 1.8.6 before? Ran 'ruby -v' again, and still 1.8.6. Obviously I was missing something. Did a bunch of digging on The Oracle and finally found two pages with useful info:
Upgrading to Ruby 1.8.7 using MacPorts
Starting over: MacPorts
Tried the deactivate/activate method from the first link, still no luck. Then from the second page and a few other things The Google found I realized that it was a PATH problem. MacPorts is supposed to prepend some path info onto the PATH in your .profile file, but I didn't have one. (Supposedly MacPorts will create it if necessary, but it didn't work for me.) Created the .profile with this in it:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATHRestarted iTerm to pick up the env changes, did a 'ruby -v', still 1.8.6! But doing a 'which ruby' gave the new MacPort path, and doing a version check with the whole path ('/opt/local/bin/ruby -v') said 1.8.7. Hm. Did the port deactivate/activate again, restarted iTerm one more time, and voila--Ruby 1.8.7! Not sure which part(s) of this were necessary, but that's what worked for me.
My unit tests still ran fine on my Mac with 1.8.7, and updating the gems on the server didn't fix anything either, so in that respect this whole exercise was a bust, but I learned something and I hope it will help other people to have all this info in one place.
UPDATE: Apparently this also impacts all the gems you have installed. I didn't want to reinstall everything, and have two copies of gems sitting around, so I did ' bunch of research until I figured out how to re-use the old gems. I was able to get all my old gems to show up by setting the GEM_HOME env var to the path the old gem tool had them in. You can find the gem location(s) by running 'gem environment' (be sure to run the old gem tool to get the old path(s), for me it was '/usr/bin/gem'). Then I put this into my .profile file:
export GEM_HOME=/Library/Ruby/Gems/1.8After doing a 'gem list' (running the new gem tool) this time all my old gems showed up. Fixing things in RubyMine took a little more work in the Preferences.
UPDATE 2: Wow, I thought all this would be easy--not so! Updating all my gems (including moving to Rails 2.3) and bumping the Ruby version caused me all sorts of headaches. Instead of getting any development done today, I've been doing this. Not gonna spend a lot of time detailing anything, but I'll list the highlights so a search may hit this post. If you have any questions about what I ran into, contact me (leave a comment, email, etc).
One big headache was a libxml2 problem having to do with nokogiri (which I have because I'm using mechanize). This may have been a 0-day issue, as I updated all my gems earlier in the day, and then when I did it again nokogiri updated. Hard to say with any certainty what caused the issue because I changed so many variables today, but my guess is that a new version of nokogiri has a problem. The issue is that it now throws up a nasty error when you're using an old version of libxml2 (like 2.6.16, which comes with OS X Leopard by default). After playing with gems/macports all day I thought there must be some solution there, and indeed there is a macport. So I installed that, still no love. Read the nokogiri message a little more carefully, and it said to uninstall the gem and reinstall it after updating libxml2 so it would build with the new library. Had some problems uninstalling it because of the ruby/gem changes I made earlier in the day, but finally got it cleaned off by calling the old 'gem' tool to uninstall it and got it cleared from both root and user gem repos. Did a reinstall, and that problem was fixed. (BTW, there is also another way.)
I mentioned earlier that I had some issues with RubyMine after my updates, one was that the mysql gem was somehow wonky. It showed up for Ruby 1.8.6 in the RubyMine prefs, but under 1.8.7 (using the same GEM_HOME for both) everything was ok except for mysql. Tried to reinstall but got an error. Finally found this post which had the right magic command.
Next up was all the issues coming from migrating from Rails 2.2 to 2.3. Basically this was just a matter of Googling error messages and finding the fixes, all small stuff. The worst of it was in my tests, which completely blew up. This page had many of the answers in one place, found the other stuff through Google searches.
Whew! But now all my tests are running (and passing) locally again, and Project Unblowuppable seems to be running fine locally. Not gonna push it out to production today, don't feel like staying up all night to fix it. :)


0 comments:
Post a Comment