views:

150

answers:

1

What do you do when you want to use a gem for development/testing that you don't want to force other devs to use? Right now I have

begin
  require 'redgreen'
rescue LoadError
end

in test_helper.rb and no gem config, but that seems like a clumsy approach, albeit a functional one. I'd like to do something like the following:

config.gem "redgreen", :optional => true

Any other suggestions? Or should I just vendor those pretty superficial gems...?

EDIT

To be clear, I am only talking about those specific gems, like redgreen, which aren't actually used in the functional code, but only in the coding process. There is no need to vendor these at all, except to avoid the conditional require.

A: 

If you want it to be optional, it's better to freeze the gem as a plugin. However, it's not a good idea to use different gems than the rest of a development team, as it creates some inconsistencies in the codebase that can be hard to track down later. I would say add it to config.gem, and just tell the other developers to do:

rake gems:install

And you're done.

Mike Trpcic
How would using redgreen lead to inconsistencies in the code base? I'm really just thinking of benchmarkers, output sugar etc, not coding tools. Obviously code you use should be specd and/or frozen.
floyd
I think regardless of what gems you use, the entire dev team should have the same suite, to ensure that bugs and issues are consitent across platforms. For example, I used Newrelic RPM on a project, and it caused bugs that nobody else encountered.
Mike Trpcic