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?

rcov 0.8.1 fixes Safari 3 colorization

Happy Thanksgiving everyone! I hope you enjoyed time with your family and friends.

Well one new thing that you can be thankful for is rcov 0.8.1. This new version of rcov fixes the colorization problem with Safari 3, which by the way now affects Ruby programmers on 10.4.11, not just those of us on Leopard 10.5.0 – 10.5.1. Note that the WebKit team is hard at work fixing the old underlying problem. It does pay to report bugs.

Anyways, enjoy the new rcov and your turkey leftovers. The easiest way to get it if you already have rcov is to do:

sudo gem update rcov

or if you don’t already have it:

sudo gem install rcov

Related posts:


Ruby bugs on Leopard

The software industry lacks political clout

So I’m still upset at this new Maryland tax on software services. I hope it is not a harbinger of what is to come. Hopefully it is just a bad move that is a short term fix for whatever is ailing Maryland’s budget. But I think it points out something that is broken about the software industry. We lack political clout.

The Washington Post had this to say in its lead editorial today titled O’Malley Increases Influence With Wins on Taxes and Slots:

Interest groups with savvy lobbyists and deep pockets got special breaks; car dealers, for example, were treated to a subsidy worth $80 million. Those who lacked comparable clout, like some segments of the computer services industry, will be hit by a sales tax increase that, inexplicably and illogically, still does not apply broadly to most services in the state.

Now, I’m not saying that we need to have any subsidies, tax breaks, or any other sort of special consideration. But it is completely unfair that the computer services industry was singled out for a new tax. We should at least be able to defend ourselves from getting sand kicked in our collective face.

Perhaps it is because thankfully, we’ve been successful. The Washington Post had this to say in its main article yesterday about the new tax titled Md Lawmakers Approve Package:

The only service agreed to yesterday by House and Senate fiscal leaders was computer services — largely because of the nearly $200 million a year in estimated revenue it could generate.

There is some hope that it will be reversed in 5 years when they review it:

Computer services that would be subject to the tax include consulting and programming help, as well as software installation and hardware maintenance. Legislative analysts said at least nine other states tax computer services. The group of legislators agreed to revisit the issue in five years to determine what effects the tax has had.

But I wonder… will we be in any better shape then as an industry to defend ourselves?

Taxes on consulting?

I woke up this morning and nearly spit out my coffee as I read that the neighboring state of Maryland (I live in Virginia) is going to start charging sales tax on computer consulting – to the tune of 6%. That starts next year, January 1st 2008. This is a huge change and seems somewhat arbitrary since among the list of things considered were landscaping services, tanning salons, saunas, etc.

I’m not sure how the Maryland software consultants are going to cope with this. The easiest theoretically but probably hardest in real life is to just move to Virginia or Pennsylvania or Delaware, which don’t tax consulting services. They could also pass the cost on to their clients – which may be ok in the short term but I think will probably put them at a disadvantage vs other companies in neighboring states. They could eat the cost, but basically that’s a 6% pay cut. Or they could go and do something else, which is unfortunate. I’d say the first and last option are those unintended consequences that you always hear about. Side-effects in programming terms.

So what about everyone else in other states? Do you have to charge your clients sales tax if you’re doing consulting?

Reinstalling RubyGems on Leopard

So you’ve got your nice shiny Mac OS X 10.5 Leopard install with all the Ruby goodies you need. Why would you want to reinstall RubyGems? Well the Ruby community moves fast and RubyGems is sort of like Software Update for Ruby. There’s also a lot more gems out there that Leopard doesn’t come with.

Oh and also you might try some things which break your local rubygems install. Like I did today after a failed attempt at updating to 0.9.5 using

sudo gem update --system

~>sudo gem list
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
~>gem list
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
~>sudo gem update --system
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
(uh oh)
~>gem update --system
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)

Hmm.. that’s not good!

One more reason to update your RubyGems is that the 0.9.5 version just came out and Leopard comes with 0.9.4. And yet another reason is that after doing so, it seems like “sudo gem” and “gem” act the same now.

Now before we start, you should:

  1. Open up ~/.bash_profile in your favorite editor (create it if its not already there)
  2. Type in
    export GEM_HOME=/Library/Ruby/Gems/1.8
  3. Type in
    export GEM_PATH=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
  4. Save ~/.bash_profile
  5. 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.

Now, download the latest version of RubyGems from http://rubyforge.org/frs/?group_id=126&release_id=16500

Finally, execute

sudo ruby setup.rb

There you go – enjoy your newly re-installed RubyGems! In the future, you should be able to just do a

sudo gem update --system

, but if that fails (which it did for me tonight), then you know how to re-install from scratch.

RubyGems 0.9.5 is now available

rubygems 0.9.5 was just released. It’s got quite a few new features, but the big one that’s bugged me for quite a while and I was going to fix but I never got around to it and now it’s finally here is: *drumroll please*

Automatic installation of the gem that is appropriate for your platform.

So now you won’t see a listing like:

gem update fastthread
Updating installed gems…
Attempting remote update of fastthread
Select which gem to install for your platform (universal-darwin9.0)
1. fastthread 1.0.1 (ruby)
2. fastthread 1.0 (ruby)
3. fastthread 1.0 (mswin32)
4. fastthread (ruby)
5. fastthread (mswin32)
6. Skip this gem
7. Cancel installation

Instead you’ll see:

gem update fastthread
Updating installed gems...
Attempting remote update of fastthread
Building native extensions.  This could take a while...
Successfully installed fastthread-1.0.1
1 gem installed
...more lines about documentation and dummy_dump and rb_queue_*...
Gems: [fastthread] updated

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!

I’m at RubyConf 2007

RubyConf 2007 is in Charlotte, NC this year. I’ve never been here before but its within driving distance from me. Its got a nice sized downtown with tall buildings. Sort of reminds me of a mini New York City in the south.

If you’re going to be at RubyConf as well, feel free to say hi – you can see my picture over at the Streamlined team page. Speaking of the Streamlined team, I know Justin, Stu, and Matthew will be there as well.