Add "bundle search" subcommand
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.
This commit is contained in:
parent
58bb228f75
commit
734c130822
1 changed files with 15 additions and 0 deletions
15
bin/bundler-search
Executable file
15
bin/bundler-search
Executable file
|
@ -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 "$@")
|
Loading…
Add table
Reference in a new issue