Skip to content

Commit

Permalink
Add "bundle search" subcommand
Browse files Browse the repository at this point in the history
Bundler 1.8+ added support for git-style subcommands. Any scripts
starting with `bundler-` in your path are executable as bundler
subcommands.

This adds `search` as a subcommand that uses `ag` to search for a string
among all gems in your bundle (default) or optionally a specific gem.
I've found this useful for finding the source of puzzling deprecations,
finding what gem provides a method, and other various things.
  • Loading branch information
derekprior authored and Greg Lazarev committed May 8, 2015
1 parent 58bb228 commit 734c130
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bin/bundler-search
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# Search your bundle for the provided pattern
# Requires bundler 1.8+ for execution as a bundler subcommand.
# Examples:
# bundle search Kernal.warn
# bundle search current_user clearance
# bundle search "Change your password" clearance
#
# Arguments:
# 1. What to search for
# 2. Which gem names to search (defaults to all gems)

pattern="$1"; shift
ag "$pattern" $(bundle show --paths "$@")

0 comments on commit 734c130

Please sign in to comment.