scatterd-dotfiles/bin/bundler-search
Derek Prior 734c130822 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.
2015-05-08 14:44:00 -07:00

15 lines
422 B
Bash
Executable file

#!/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 "$@")