boxen/puppet-homebrew — pull request #58 by a-warner (2014-09-25 00:23:12+00:00)
Title: Pour bottles to the correct directory

- If a bottle includes a revision number, homebrew expects it to
be installed to a directory of the form bottle-name/version_revision
- This change simply extracts the bottle to the exact directory that
homebrew expects it to be in, by grabbing that directory off of the
formula definition

In my case boxen was failing to install `ossp-uuid`, because `boxen-bottle-hooks` was extracting it to

`/opt/boxen/homebrew/Cellar/ossp-uuid/1.6.2`

but homebrew was expecting to find it in

`/opt/boxen/homebrew/Cellar/ossp-uuid/1.6.2_1`

Homebrew gets the expected directory name via `formula.prefix` ([code](https://github.com/Homebrew/homebrew/blob/8144d1b183c7384b704b0ed5dae2976f819d2e3b/Library/Homebrew/formula.rb#L147-L149)), and will [raise if the directory doesn't exist](https://github.com/Homebrew/homebrew/blob/8144d1b183c7384b704b0ed5dae2976f819d2e3b/Library/Homebrew/keg.rb#L98-L99).