Created
January 1, 2011 03:11
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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