Skip to content

Instantly share code, notes, and snippets.

@auxesis
Created January 1, 2011 03:11
Show Gist options
  • Select an option

  • Save auxesis/761527 to your computer and use it in GitHub Desktop.

Select an option

Save auxesis/761527 to your computer and use it in GitHub Desktop.
Quick and dirty shell function to cd to a gem's install location.
# Insert into your .bashrc
function open_gem() {
if [ -z "$1" ]; then
echo "Usage: open_gem <gem>"
return 1
fi
name=$1
src=$(gem which $name)
if [ "$?" == "0" ]; then
path=$(dirname $(dirname $src))
cd $path
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment