wycats/thor — pull request #243 by tomasv (2012-08-05 02:26:02+00:00)
Title: Uncomment line does not properly uncomment lines

If a blank commented line precedes a line to be uncommented,
then it does not get uncommented properly.

Given this standard excerpt from spec_helper.rb that rspec:install of rspec-rails generates:
```ruby
RSpec.configure do |config|
# ## Mock Framework
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
end
```
using
```ruby
uncomment_lines 'spec/spec_helper.rb', 'mock_with :mocha'
```
gives us this:
```ruby
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
end
```

The problem is with the regex, \s matches newlines as well as spaces, so an empty comment line causes greediness to kick in and mess things up.

Fix and an extra spec for this attached.