Skip to content
Browse files

rbenv plugin now uses 'brew --prefix rbenv' command to find rbenv folder

  • Loading branch information...
1 parent e8d582a commit e9a9deacb09196a48a39adc827d861e1896f4c59 @timsly timsly committed Jun 18, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 plugins/rbenv/rbenv.plugin.zsh
View
15 plugins/rbenv/rbenv.plugin.zsh
@@ -1,5 +1,18 @@
+function is_homebrew_installed() {
+ type brew &> /dev/null
+}
+
+function is_rbenv_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 is_homebrew_installed && is_rbenv_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

0 comments on commit e9a9dea

Please sign in to comment.
Something went wrong with that request. Please try again.