Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
rails-project-gem-grep-r
#!/bin/bash
(($#<1)) && { echo 'usage: rails-project-gem-grep-r "search_target"' >&2; exit 1; }
search_target=$1
while [ 1 ]; do
if [ -f 'Gemfile.lock' ]; then
bundle list |
awk '/\*/ {print $2}' |
xargs -n1 bundle show |
xargs -n1 grep -r $search_target
exit $?
fi
cd ..
if [ "$PWD" = "/" ]; then
echo 'fail' 1>&2
exit 1
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.