Rails Test Prescriptions Blog

Keeping Your Application Healthy Since 2008

August 31, 2010: Bundled Mockingjays

Book Status

Editing the RSpec chapter, which I expect to be done today, it’s all done except for a couple of hard questions from the editor which last-night me decided to leave for this-morning me, so that last-night me could finish Mockingjay. Thanks, last-night me!

A Bundler Question

I’m not sure whether this is a feature-request or an I-don’t know what I’m doing request.

I’ve been using Bundler with a Rails 2.3.8 project, and it’s been working just fine for the most part, I like it. There’s one issue. The project also involves active development on a gem (so that business logic classes can be shared among multiple projects), and I’m not sure how to handle the case in Bundler.

The gem is a separate git repo. In development, the gem is specified in Bundler as a path, so that a developer can work on both without having to push the gem back to the central repo. In staging, though, the gem is specified via git based on the staging branch, and in production it’s specified via git based on the master branch.

What I would like to do is specify the same gem as having different sources in different groups, something like

group :production do
  "common_gem", :git => "git_repo"
group :development do
  "common_gem", :path => "dev path"

But bundler won’t let me do that because all it sees is the duplicate definition.

Has anybody had a similar issue? Right now, we’re resolving this via checkin scripts that ensure that various branches have the right gemfile when deployed. But it’s an awkward solution.


Okay, I did finish it. I’m mostly amazed at how the Hunger Games books somehow became this year’s YA Book That It’s Okay For Grownup’s To Read. (It’s even got a multi-grownup book discussion on Slate). Trying to decide how I feel about the book, and this may not be the place to go on at length. Still, recommended — even with some flaws, the series is energetic and interesting.


One response to “August 31, 2010: Bundled Mockingjays

  1. TJ Singleton August 31, 2010 at 12:55 pm

    We’ve been faced with not wanting heroku to bundle dev and test gems. However, heroku does not support just bundling a specific group. We get around this by filtering out the groups based on environment variables. Not an elegant solution, but it works.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: