Fun with Bundler

On Aeolus Conductor, we’re using Rails 3. Although I’ve been using Rails for years, some part of Rails 3—namely, Bundler—are still relatively new to me.

The problem I ran into is that we have a :development, :test group defined, but it’s being installed in all environments. This is as described, but inconvenient when you’re trying to ship two separate RPMs—one package for end-users, and a -devel version for developers that depends on the gems in the :development and :test groups.

It turns out that, by design, bundle install will install all gems in all groups, but Rails will only load those in the relevant environments. They have a good reason for doing this, but for certain use cases, this is inconvenient. It’s easy enough to skip this: bundle install --without=development test does the trick.

But what trips me up is that it’s a “remembered setting,” something which is poorly-documented as far as I can tell. (But maybe I’m looking in the wrong places.) The problem is that there’s no apparent way to un-remember these flags, which is the subject of #867. Right now, you’re left manually editing .bundle/config to remove them. This works, but is really annoying. (#1006 argues that the whole “remembered options” feature is counter-intuitive and should be excised.)

Leave a Reply

Your email address will not be published. Required fields are marked *