Base rbenv plugin on the rbenv in the path.

Rather than do our own searching, this gives the user full control of
the PATH variable and of the search order for rbenv.  It's also probably
faster, since we let zsh do the searching for us.
This commit is contained in:
Peter Jaros 2012-05-17 15:07:50 -04:00
commit c4a5ac62c8

View file

@ -1,22 +1,4 @@
FOUND_RBENV=0
for rbenvdir in "$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" ; do
if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then
FOUND_RBENV=1
export RBENV_ROOT=$rbenvdir
export PATH=${rbenvdir}/bin:$PATH
fi
done
unset rbenvdir
# If not found above, check for the existence of the rbenv executable anyway.
if [ $FOUND_RBENV -eq 0 ] ; then
if ( which rbenv > /dev/null 2>&1 ) ; then
FOUND_RBENV=1
export RBENV_ROOT=$(rbenv root)
fi
fi
if [ $FOUND_RBENV -eq 1 ] ; then
if [[ $+commands[rbenv] -eq 1 ]] ; then
eval "$(rbenv init -)"