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.

20 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.

  4. I am really loving the theme/design of your weblog. Do you ever run into any internet browser compatibility issues? A few of my blog readers have complained about my blog not operating correctly in Explorer but looks great in Firefox. Do you have any recommendations to help fix this problem?

  5. First off I want to say great blog! I had a quick question that I’d like to ask if you don’t mind. I was interested to find out how you center yourself and clear your thoughts before writing. I’ve had a tough time clearing my mind in getting my thoughts out. I truly do take pleasure in writing however it just seems like the first 10 to 15 minutes tend to be lost just trying to figure out how to begin. Any recommendations or hints? Thank you!

  6. you are really a excellent webmaster. The web site loading velocity is incredible. It sort of feels that you’re doing any unique trick. Also, The contents are masterwork. you’ve performed a fantastic task on this topic!

  7. Perfectly indited written content, thank you for selective information. “The bravest thing you can do when you are not brave is to profess courage and act accordingly.” by Corra Harris.

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="">