What to do before you do Ruby on Rails development on Mac OS X Leopard
Apple has a new series about Ruby on Rails development on Mac OS X Leopard. Its a nice article to help get you going. One thing I’d like to reiterate is that it is good to lock down your RubyGems paths. This way you will always that your RubyGems go in the right directories that Apple has set up.
So before you follow the steps in the initial Developing Rails Applications on Mac OS X Leopard article, you should take the following steps:
- Open up ~/.bash_profile in your favorite editor (create it if its not already there)
- Type in
export GEM_HOME=/Library/Ruby/Gems/1.8 - Type in
export GEM_PATH=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 - Save ~/.bash_profile
- Execute
source ~/.bash_profile
This makes it so that no matter what version of rubygems you have, you have access to the Apple-provided gems in $GEM_PATH and you’re able to install/update new gems in $GEM_HOME.
2007 Training in Review
Last year I took a lot of training. In the past, my employers would usually send me to one training event. Sometimes I would get to go to two if times were good. Other times, there was no training budget.
In 2007, I was self-employed as the sole member of Happy Apps LLC. So being in charge of the training budget (well actually the entire budget), I went to six training events:
- Rails Edge in Reston, VA
- Advanced Rails in Chicago, IL
- WWDC in San Francisco, CA
- RailsConf in Portland, OR
- Advanced Ruby in Reston, VA
- RubyConf in Charlotte, NC
So that’s 2 Ruby conferences, 3 Rails conferences, and one Cocoa conference. I actually was scheduled to go to another Cocoa conference, C4[1] over in Chicago, but had to cancel due to personal reasons.
So which ones were good and which ones were bad? I think they were all quite good. Obviously, if you want to make Mac applications like I do with WebnoteHappy, you’ll want to go WWDC.
In terms of being a good Ruby on Rails developer, I’d have to say that assuming that you already have a good background in object-oriented programming and web development, have worked through a beginning Rails book like Agile Web Development with Rails, then you really should take both the Advanced Ruby course by Pragmatic Studio, followed by the Advanced Rails course. Both taught me quite a lot of things that I hadn’t known before.
Once you’ve got that though, I think its important to keep up with the latest in techniques and also be involved in your programming community. I think The Rails Edge Conference is top notch in keeping up with what’s new in the Rails world. I hope that a date is announced soon though - I don’t see one for 2008 as of today.
RailsConf is also good for keeping up with Rails, but I think is maybe even better for just being involved in the Rails community. There were a lot of opportunities, scheduled and unscheduled, to get together with fellow RoR developers and you could sense that Rails is really changing the way that web development is being done.
RubyConf on the other hand reminded me that Ruby is not just about Rails. There’s certainly been a lot of growth of Ruby use because of Rails, but there is a deep and wide pool of talent that has fallen in love with Ruby. It was interesting to see all the different uses that people have made of Ruby. And it was definitely an honor and a pleasure to meet Matz in person. In the end, it does seem like most people who are doing Ruby full-time are making their money with Rails.
I’m trying to plan out my training in 2008 now. So I’m curious to hear what good conferences or classes other people went to in 2007. Also if there were any bad ones.
What tools do you use for Ruby on Rails?
I’m curious to see what people are using for Ruby on Rails development. I know there are a lot of products coming out nowadays - 3rd Rail from Borland, IntelliJ IDEA (my preferred IDE before Eclipse when I used to Java/Swing) does Ruby now, NetBeans is positioning itself as a Ruby IDE, Aptana, Eclipse/RDT, etc. But I don’t have enough time to try them all out.
I personally use TextMate. It’s simple but powerful. I do a fair amount of work on the command line too, using rake tasks and then shortening up my most used rake tasks or ruby scripts with bash aliases.
Is there something out there I should try that would work better? I’d preferably like something still lightweight, makes it easy to run tests and navigate files, but supported code completion, refactoring, and some sort of double-clicking to find the declaration of a method.
So… what tools do you use for Ruby on Rails?
Ruby bugs on Leopard
I installed Leopard about 2 weeks ago and been doing Ruby on Rails development on it since. I encountered some bugs initially, but I managed to conquer them. I think Leopard’s great for doing RoR development. It seems faster, it seems more polished, its just very pleasant to do work in.
Here’s what I learned though about Ruby in Leopard:
1. Don’t update rubygems. It’s already up-to-date (at least as of this writing.) If you do a “gem update –system” on Leopard, you will be sorry. Because you’ll suddenly break the careful packaging Apple has done with Ruby and reduce the 20 or so gems (not sure the exact count) available down to 0.
There’s a simple fix for this though - what happens is that the places where it looks for your gems gets mixed up. What you need to do is go into your ~/.bash_profile and enter in:
export GEM_HOME=/Library/Ruby/Gems/1.8
export GEM_PATH=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
Then do a
source ~/.bash_profile
The reason why this fixes it is that GEM_PATH now points to the place where Apple put all the system-provided gems. GEM_HOME points to where Apple originally set to where you install gems. Note that GEM_PATH is “read-only” whereas GEM_HOME Is “read-write” by rubygems. Oh and if you do this, you can safely update rubygems. :)
2. rcov is broken, but you can fix it.
For some reason, rcov out of the box will include some of its own classes in the reports when profiling functional tests on Leopard. This throws off the coverage statistics.
The fix for this is to include “#{ENV[’GEM_HOME’]}” in the rcov exclusions parameter –exclude.
3. rcov reports don’t show up colorized in Safari 3.
Now once you’ve got rcov working, when you click on a class to see what lines are covered and which aren’t, you find out that you can’t on Leopard. Well that’s not exactly right. It turns out that its Safari 3. I also tested it out with the latest WebKit nightlies - its broken too. I looked into this and found that some old rcov 0.4 reports on the web render fine, but the newer rcov 0.8 ones don’t. It seems Safari 3 doesn’t like some of the internal anchor tags.
The workaround for this is to use any other browser for viewing your rcov reports on Leopard. If you’re using Firebug, you might as well use Firefox. Otherwise, Camino is good. Or if you’re the power user type, OmniWeb. Cutting edge - Shiira. I could go on and on - I’m a browser fanatic. Did I mention Flock?
Anyways… Ruby development on Leopard is actually quite good. These 3 bugs were not that big a deal. I think its great that Leopard ships with all sorts of Ruby goodness built right in. And I didn’t even mention RubyCocoa or anything like that.
Any other tips for Ruby development on Leopard? Let me know via a comment!
How to run Cisco VPN over EVDO when you’ve got VMWare Fusion installed
Well I finally got one of those EVDO cards, specifically a Novatel Wireless Merlin EX720 that fits nicely in the Express Card slot of my MacBook Pro. It works great pretty much everywhere I go, but there’s one thing that’s bugged me: the Cisco VPN would drop when I was on EVDO, just a few seconds after I connected.
At first, I fixed it by upgrading to a newer version of the Cisco VPN client. That fixed some issues with Parallels. All was good until I also installed VMWare Fusion. (Note that this is all on Mac OS X 10.4.10.) But today I figured out what you need to do (thanks to Michael Renner for the tip in the VMWare Community):

1. Download the latest Cisco VPN client. As of this writing, the best available is 4.9.01.0080. Fortunately, MacUpdate is hosting downloads of Cisco VPN 4.9.01.0080.
2. Go into Terminal and run:
sudo /Library/Application\ Support/VMware\ Fusion/boot.sh --stop
This has the side-effect of disabling VMWare Fusion. I think what’s happening is a conflict in the kernel extensions.
3. Start up Cisco VPN, connect and enjoy.
4. Either immediately after or later when you need VMWare Fusion, you can go back and run
sudo /Library/Application\ Support/VMware\ Fusion/boot.sh --start
to re-enable it.
(Updated 3/10/2008: Ensured that the backslashes in the shell commands are available to be copied from your browser - they were getting stripped out by the blog.)
CCMenu helps you monitor your builds
You’re using continuous integration, right? If not, you really should. And you should probably set it up to email you if the build breaks. But there’s a nice way to get notification right on your OS X desktop: it’s CCMenu.
CCMenu is a menu item for OS X that displays the status of your projects that are being built with CruiseControl. It works with CruiseControl.rb as well which you can use for your Ruby on Rails projects, which is where I mainly use it. When your projects are good, it shows a green rounded square and when your projects break, it shows a red one. It also uses Growl to notify you whenever there is a status update on any of your projecs. Its freeware and available thanks to Erik Doernenburg.
One tip: you can have it start up automatically by going to System Preferences > Accounts > Login Items and adding CCMenu and then checking the checkbox. Perhaps that will be a preference in the future, but for now that works for me.
Rails 1.2.4 - getting ready for Rails 2.0
Rails 1.2.4 came out today. The big thing here in my opinion is that it helps you get ready for Rails 2.0, since it includes more deprecations.
I had to fix a deprecation for pagination, which will be optional in 2.0. To fix it, I piston installed the classic_pagination plugin from the guys at errtheblog:
piston import svn://errtheblog.com/svn/plugins/classic_pagination vendor/plugins/classic_pagination
By the way, this also affects Streamlined, which uses pagination.
Another thing in 1.2.4 is that REST URLs don’t use the semicolon “;” anymore, instead they just use the regular slash “/”. So instead of doing /comment/1;edit which always seemed a little weird, we’ll now use /comment/1/edit.
Also in 1.2.4 are security updates and “minor performance enhancements.”
I usually freeze Rails and I dug up my rails:refreeze rake task to do it, which does it all automatically. I’ll blog that soon. I wonder - is there a place where you share rake tasks? Is there a Rake-forge?
Automated CRUD Plugins BOF tonight at 8:30pm
We’ll be gathering together all the Rails folks who want better scaffolding, like Dave Thomas said he wanted last year, tonight at the Automated CRUD Plugins BOF - scaffolding and beyond. It’s at 8:30PM over in Room C122.
Lance and Rich from ActiveScaffold will be there. Matthew and I will be representing Streamlined. Hopefully we’ll have representative from Hobo, AutoAdmin, and Scaffolding Extensions. Anyone else who wants to contribute is welcome too. See you there!
JRuby 1.0 coming at end of May
Sitting through the Sun keynote at RailsConf. Tim Bray is up and speaking and making it clear that Sun likes Ruby. Which is a good thing, but I guess we haven’t seen so much commercial sponsorship in the Ruby world that it seems somewhat strange, but good.
I think it’d be great if Sun put a lot of resources into creating a world-class Ruby VM. They have some good experience in that space with Java. Of course, maybe they’re killing two birds with one stone with JRuby.
Charles Nutter came up on stage and announced a few things about JRuby:
The 1.0 release candidate 2 is out now.
JRuby 1.0 is coming out at the end of the month.
You can get a t-shirt in exchange for submitting a patch.
Oh, also Tim took a poll and it seems like 1/2 the audience works for a startup, 1/2 for an existing company, and 1/3 for a consulting company. Yea it all adds up to 1 1/3rd, but the question was a little fuzzy. For some reason I thought it’d be consultants mostly, then existing companies, and then startups. But I guess we’re in a new kind of world here, one that Paul Graham loves and has predicted.
9 Things that DHH likes about Rails 2.0
- Breakpoints are back. Wait, actually there’s a real debugger in there?!
- HTTP Performance has improved. Any JavaScript and CSS that uses the *_include_tag with :cache => true will be bundled and gzipped up, so the browser will make less connections and fetch less data across the wire. Also spreading assets around to different servers will be easier to parallelize the browser downloads.
- ActiveRecord Query caching. If there’s no inserts, updates, or deletes (which would invalidate the cache) it will just return the next selects out of its cache. You use ActiveRecord::Base.cache do/end, though I guess this will be the default soon.
- Splitting out rendering and response type for template names. This adds conventions for the template names which help Rails figure out which one to use for a given response.
- config/environment.rb is now modularized
- DRYer migrations - fields are now grouped by type (I guess we lose the order, but don’t think that really mattered.)
- HTTP Authentication is baked in now. You can use authenticate_or_request_with_http_basic in a before_filter. (Also just authenticate_with_http_basic and request_with_http_basic.)
- Assume MIT license.
- Spring cleaning. I think the Rails Core actually means it when they deprecate things (as opposed to Java which sort of just warns you forever.)
