Created
March 20, 2009 14:43
-
-
Save abachman/82386 to your computer and use it in GitHub Desktop.
This file contains 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
# drop in your ~/.bashrc file. guaranteed to "works on my machine". | |
# | |
# Go straight to the root of the current rails project. | |
# example: | |
# ~/workspace/proj/app/models $ rr | |
# going to /home/user/workspace/proj | |
# ~/workspace/proj $ | |
# | |
# /etc/init.d/ $ rr | |
# /etc/init.d/ $ | |
rr() { | |
CURRENT_PWD=`pwd` | |
FAILED_RR=0 | |
# Drop down the path until we hit a directory containing | |
# "app" "config" "log" and "test" | |
until [[ "$(ls)" =~ ^app.*config.*log.*test ]]; do | |
cd .. | |
if [ $(pwd) = / ]; then | |
FAILED_RR=1 | |
break | |
fi | |
done | |
if [ $FAILED_RR -eq 1 ]; then | |
cd $CURRENT_PWD | |
else | |
echo "going to `pwd`" | |
fi | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment