svenfuchs
4/18/2010 - 10:03 AM

Why Bundler should support multiple bundles

I would like to be able to have multiple bundles (or Gemfiles) per project. 
I'd imagine things to work like this:

  Gemfile.a1
    gem 'a', '~> 1' # depends on gem b (1.0.0)
  
  Gemfile.a2
    gem 'a', '~> 2' # depends on gem b (2.0.0)
  
Now `bundle install` would install all the relevant versions:

  a (1.0.0)
  a (2.0.0)
  b (1.0.0)
  b (2.0.0)
  
From the runner/application/process I could now pick a bundle that I want to 
work within:

  bunde exec a1 ruby test/all.rb # runs test/all.rb within bundle a1
  bunde exec a2 ruby test/all.rb # runs test/all.rb within bundle a2
  
Even if `bundle exec` can't easily be extended like this I still might have
my own bundle-aware runner that could do something like:

  bundle = Bundler.pick('a1')
  bundle.setup(:group1, :group2)
  
instead of:
  
  Bundler.setup(:group1, :group2)
  
This would unlock tons of flexibility and power that - unless I'm missing 
something big - not available with Bundler.

E.g. it would be a snap to test a particular version of the I18n gem against 
several Rails versions on Heroku. 

With the current Bundler single-bundle design that always only allows to 
install a single, consistent bundle and run stuff within this bundle I'd have 
to set up a CI server per Ruby version AND per Rails version that I want to 
test against on Heroku. (Which of course is possible but really ugly.)

Being able to tell the server to pick up one of many Gemfiles/bundles which 
all already are installed on my Heroku stack I'd only have to maintain a stack
per Ruby version (like 1.8.7 and 1.9.1). I could then have the CI server run
my tests against each of the installed bundles.