carsomyr/rbenv-bundler — pull request #9 by mbrictson (2012-01-18 20:26:34+00:00)
Title: Search $bundle_path/bin in `which` and `exec`

As mentioned in carsomyr/rbenv-bundler#8, depending on how Bundler is configured, binaries can be installed in one of two locations. When BUNDLE_PATH is defined in the project .bundle/config file, Bundler installs gems using a structure like this:

```
.bundle/vendor/
└── ruby
└── 1.9.1
├── bin
├── cache
├── doc
├── gems
└── specifications
```

However if BUNDLE_PATH is defined globally in $HOME/.bundle/config, Bundler installs gems like this:

```
.bundle/vendor/
├── bin
├── cache
├── doc
├── gems
└── specifications
```

Therefore, when determining what executable to run for a given bundled project, two searches need to be performed. This affects `rbenv which` and `rbenv exec`. Accomplish this by defining a `find_bundled_executable` function that can be used by both of those commands.