public
Created

  • Download Gist
functions.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# cd into a matching gem directory. Pass a grep compatible
# regular expression. If you don't pass anything, it goes
# to the root gem directory.
cdgem ()
{
local gempath=$(gem env gemdir)/gems;
if [[ $1 == "" ]]; then
cd $gempath;
return;
fi;
local gem=$(ls $gempath | grep $1 | sort | tail -1);
if [[ $gem != "" ]]; then
cd $gempath/$gem;
fi
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.