Fix error when trying to open a local gem.

For local gems, the gem name can not reliably be determined from the path (local gems can live in arbitrarily named directories: `gem 'foobar', :path => '/path/to/something'`).

Instead, use Bundler's API to get a list of all gem names and paths.

Tested with Ruby 1.8.7 and Ruby 1.9.3.