wireframe/bundler-reorganizer — pull request #1 by NotDaveLane (2014-04-05 03:32:29+00:00)
Title: Fix for a variable scoping issue which can reorganize default gems into an improper group

This pull request is for an edge case I encountered with reorganization of gems listed outside of a group at the end of a `Gemfile`. When a gem intended for the implicit `:default` group is declared below a non-default group, the gem is unintentionally scoped within the non-default group. For example:

# original Gemfile
source "https://rubygems.org"

gem "mysql2"
group :test do
gem "database_cleaner"
end
gem "unicorn"

Running bundler-reorganizer 1.1.0 on the above example produces the following unexpected result:

# reorganized Gemfile
source "https://rubygems.org"

gem "mysql2"

group :test do
gem "database_cleaner"
gem "unicorn"
end

The expected result would be the following:

# reorganized Gemfile
source "https://rubygems.org"

gem "mysql2"
gem "unicorn"

group :test do
gem "database_cleaner"
end

My commit addresses this by fixing a scoping issue with the `current_group` member variable's reassignment to `nil` in the `group` method in `lib/bundler/reorganizer/cli.rb`.

Thank you for building a gem that scratches my OCD itch!