Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Wrapper for rvm-prompt that searches parent directories for files that tell we're in a Ruby project dir or sub-dir
#!/bin/bash
# Use this script instead of ~/.rvm/bin/rvm-prompt
# and the output of rvm-prompt will show up in your command prompt
# only if you are in a Ruby project directory.
# see http://stackoverflow.com/a/4264351/270511
# and http://unix.stackexchange.com/questions/13464/is-there-a-way-to-find-a-file-in-an-inverse-recursive-search
upsearch () {
the_test=$1
up_to=$2
curdir=`pwd`
result=1
while [[ "`pwd`" != "$up_to" && "`pwd`" != '/' ]]; do
if eval "[[ $the_test ]]"; then
result=0
break
fi
cd ..
done
cd $curdir
return $result
}
if upsearch '-e Gemfile || ! -z "$(shopt -s nullglob; echo *.gemspec *.rb)"' ; then
~/.rvm/bin/rvm-prompt
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.