Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1174 from insside/rbenv-homebrew-fix

rbenv plugin now uses 'brew --prefix rbenv' command to find rbenv folder
  • Loading branch information...
commit 3ac3141cd610de995b2435011ac895ad15b89e2e 2 parents 493238e + 5931f64
Robby Russell robbyrussell authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 plugins/rbenv/rbenv.plugin.zsh
15 plugins/rbenv/rbenv.plugin.zsh
View
@@ -1,5 +1,18 @@
+_homebrew-installed() {
+ type brew &> /dev/null
+}
+
+_rbenv-from-homebrew-installed() {
+ brew --prefix rbenv &> /dev/null
+}
+
FOUND_RBENV=0
-for rbenvdir in "$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" ; do
+rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv")
+if _homebrew-installed && _rbenv-from-homebrew-installed ; then
+ rbenvdirs=($(brew --prefix rbenv) "${rbenvdirs[@]}")
+fi
+
+for rbenvdir in "${rbenvdirs[@]}" ; do
if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then
FOUND_RBENV=1
export RBENV_ROOT=$rbenvdir
Please sign in to comment.
Something went wrong with that request. Please try again.