Signal playing nice with Bundler

When Signal changed to Bundler as the gem dependency manager, all the projects inside it that were also using Bundler started to break, as some gems were not being loaded. This behavior did also occur with other continuous integration tools that also use Bundler, like Integrity.

This problem happend because when Bundler is loaded it sets some environment variables like BUNDLE_GEMFILE and this environment variables were being read by the projects inside Signal.

Let’s suppose Signal is installed in /var/local/apps/signal. When Signal is started, it will load Bundler and Bundler will try to read the environment variable BUNDLE_GEMFILE to know where the Gemfile is. As BUNDLE_GEMFILE is empty, it will read the Gemfile in the application root path and set this path to BUNDLE_GEMFILE. At this moment, the value of BUNDLE_GEMFILE is /var/local/apps/signal/Gemfile.

Now lets imagine we have a project inside Signal called Panthers and that his build script is like this:

bundle install
rake spec

When this script is executed by Signal, it will load Bundler and again Bundler will try to read the environment variable BUNDLE_GEMFILE to know where the Gemfile is. The problem is that at this time BUNDLE_GEMFILE would be set to /var/local/apps/signal/Gemfile and because of this Bundler will load Signal‘s gems instead of Panther’s gems.

To resolve this, now when Signal executes a build script, it unsets some environment variables like BUNDLE_GEMFILE and RAILS_ENV, trying to simulate a “clean” environment.

If you know a better solution for this, please let me know.

7 thoughts on “Signal playing nice with Bundler

  1. Bundler provides its own mechanism to execute code in a clean environment: Bundler.with_clean_env. You can use it like this:

    Bundler.with_clean_env do
    system(“bundle install”)
    end

  2. The subsequent time I learn a weblog, I hope that it doesnt disappoint me as a lot as this one. I imply, I do know it was my option to learn, however I really thought youd have something interesting to say. All I hear is a bunch of whining about something that you would repair if you werent too busy looking for attention.

    • thanks for the post! i had the same problem, and you came up first on goolge. very helpful. for me, it seemed /config/boot.rb was the best place to put a fix.thanks again!

    • Ryan, exactly. We’ve figerud it out how to organize contributions to a projects that are alive. But there’s no typical gentlemanly workflow to take over the project. Typically it leads to dozens of forks that die in a month – everybody willing to keep maintenance act separately bringing the chaos in. On the other side giving master level of control to anyone having one accepted PR sounds way too extreme.+1.

  3. Magnificent goods from you, man. Sun Damaged to “Sun Virgin”! I’ve understand your stuff previous to and you are just too wonderful. I actually like what you’ve acquired here, really like what you are stating and the way in which you say it. You make it enjoyable and you still care for to keep it smart. I can’t wait to read far more from you. This is actually a great Sun Damaged to “Sun Virgin”! informations.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">