Cimm
Cimm

Reputation: 4775

Bundler not loading the correct Gemfile

I'm installing a Ruby CI server which is pulling my Rails git repos from Github and installing the gems with Bundler. The CI server has a Gemfile of itself (as it's also a Rails application). So far so good.

Now, I first run a bundle install after a new git pull, this works fine:

bundle install --gemfile=[..]/build_13/Gemfile --deployment

Next I list the installed gems and run rake (to run the test suite):

bundle list
bundle exec rake

That's where it's going worng. These last 2 commands load the Gemfile of the CI server which is different from the one installed a few seconds ago. This Gemfile is in a parent directory of the one I want to run so I suppose it first finds the "parent" Gemfile and forgets to look for the correct one.

Any idea how I can tell bundler to use the correct gems?

Upvotes: 4

Views: 1639

Answers (1)

Cimm
Cimm

Reputation: 4775

Got it!

You can specify the Gemfile path as an environment variable:

export BUNDLE_GEMFILE=[..]/build_13/Gemfile

This will force Bundler to use the correct Gemfile. Thanks to Philippe Creux' article for pointing me in the right direction.

For future reference:

I'm using BigTuna as my CI server and you'll need to add the statement above for each of the 'steps' to make it work.

Upvotes: 4

Related Questions