Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Bundler.setup(:group) clears previously bundled load paths with no way to re-load them #932

Closed
wants to merge 1 commit into from

2 participants

@tigris

If you call Bundler.setup(:group) then call it again with a different group (e.g. :test), the load path from the first call gets wiped. Since setup() caches what it has previously loaded, calling Bundler.setup(:group) again will have no effect.

Not sure how to set github labels for this but i've tested on 1.0.7 (current stable) and 1.1pre (current master), it's a bug in both versions.

@tigris tigris Add test and fix for a bug where Bundler.setup() will clean the load_…
…path but also not re-load previously loaded paths for gem groups.
d44f116
@indirect
Owner

Allow groups to be loaded again if they been cleared

Closed by c3b93d3

@indirect
Owner

Hey, thanks for reporting this! We wound up unable to use your patch because of another bug that we discovered while applying it. There was not previously a test for the bug we found, so we added tests for both the issue you discovered and the other one that we found while investigating. :)

@tigris

No problem. Thanks for fixing it.

FWIW, I had trouble figuring out what the expected behavior was when you call Bundler.setup() twice with separate groups. E.g. should both groups get loaded, or is the last call to setup() the groups you should have. Which, based on your fix, it looks like I got it wrong anyway so my patch wouldn't have been what you wanted :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 12, 2011
  1. @tigris

    Add test and fix for a bug where Bundler.setup() will clean the load_…

    tigris authored
    …path but also not re-load previously loaded paths for gem groups.
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 5 deletions.
  1. +3 −5 lib/bundler.rb
  2. +11 −0 spec/install/gems/groups_spec.rb
View
8 lib/bundler.rb
@@ -99,12 +99,10 @@ def setup(*groups)
# Load all groups, but only once
@setup = load.setup
else
- # Figure out which groups haven't been loaded yet
- unloaded = groups - (@completed_groups || [])
- # Record groups that are now loaded
+ # Record groups that should now be loaded
@completed_groups = groups | (@completed_groups || [])
- # Load any groups that are not yet loaded
- unloaded.any? ? load.setup(*unloaded) : load
+ # Load all groups that should be loaded
+ load.setup(*@completed_groups)
end
end
View
11 spec/install/gems/groups_spec.rb
@@ -43,6 +43,17 @@
out = run("require 'thin'; puts THIN")
out.should == '1.0'
end
+
+ it "sets up multiple groups paths if Bundler.setup call is repeated" do
+ out = run(<<-R, :emo).split
+ require 'thin'; puts THIN
+ Bundler.setup(:default)
+ require 'rack'; puts RACK
+ Bundler.setup(:emo)
+ require 'activesupport'; puts ACTIVESUPPORT
+ R
+ out.should == ['1.0', '1.0.0', '2.3.5']
+ end
end
describe "installing --without" do
Something went wrong with that request. Please try again.