bundle show: searching

The show command still has one more trick up it's sleeve, though:

bundle show --paths
Printing a list of paths may not sound terribly useful, but it makes it trivial to search through the source of every gem in your bundle. Want to know where ActionDispatch::RemoteIp is defined? It's a one-liner:

$ grep ActionDispatch::RemoteIp `bundle show --paths`
Whether you use grep, ack, or ag, it's very easy to set up a shell function that allows you to search the current bundle in just a few characters. Here's mine:

function back () {
ack "$@" `bundle show --paths`
With that function, searching becomes even easier:

$ back ActionDispatch::RemoteIp

Véase Hack your bundle for fun and profit

Casiano Rodriguez León 2015-06-18