carlhuda/bundler — pull request #1863 by jimmycuadra (2012-04-22 07:48:40+00:00)
Title: Subgroups

This patch adds a new method `include_group` to the Bundler DSL which allows one group to be included in another. The goal is to be able to group dependencies by their function, and later declare which functional groups should be loaded in which environments (e.g. production, development). It would look something like this simplified example:

```ruby
# Default group

gem "rails"

# Functional groups

group :pry do
gem "pry"
gem "pry-rails"
gem "pry-nav"
end

group :unit_tests do
gem "rspec-rails"
gem "factory_girl"
end

group :integration_tests do
gem "capybara"
gem "poltergeist"
end

# Environment groups

group :development do
include_group :pry
end

group :test do
include_group :unit_tests
include_group :integration_tests
end
```

These composable groups allow for better organization of large Gemfiles.

This is my first foray into the Bundler code, so I'm opening this pull request very early to get feedback on whether or not the Bundler team would be receptive to this feature. If so, I'd like to get some feedback on my approach and what potential complications and edge cases I should consider and test for. The most obvious limitation so far is that subgroups must be defined before they are included in order to have any effect.

Thanks for your time!