From c4a5ac62c886d18f80deafa29b4797150f99115b Mon Sep 17 00:00:00 2001 From: Peter Jaros Date: Thu, 17 May 2012 15:07:50 -0400 Subject: [PATCH] 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. --- plugins/rbenv/rbenv.plugin.zsh | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh index 3d2834c20..96d1e7ce7 100644 --- a/plugins/rbenv/rbenv.plugin.zsh +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -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 -)"