e9a9deacb09196a48a39adc827d861e1896f4c59
- Author
- Tima Maslyuchenko <dudapip3@gmail.com>
- Committer
- Tima Maslyuchenko <dudapip3@gmail.com>
- Date
Message
rbenv plugin now uses 'brew --prefix rbenv' command to find rbenv folder
Diff
1diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh
2index ae37404cd8328ab621cb4f8ab804cc143efbe9c0..a0a64c7e47ca2b9b47ac790e94f08e3798ae72c8 100644
3--- a/plugins/rbenv/rbenv.plugin.zsh
4+++ b/plugins/rbenv/rbenv.plugin.zsh
5@@ -1,5 +1,18 @@
6+function is_homebrew_installed() {
7+ type brew &> /dev/null
8+}
9+
10+function is_rbenv_installed() {
11+ brew --prefix rbenv &> /dev/null
12+}
13+
14 FOUND_RBENV=0
15-for rbenvdir in "$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" ; do
16+rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv")
17+if is_homebrew_installed && is_rbenv_installed ; then
18+ rbenvdirs=($(brew --prefix rbenv) "${rbenvdirs[@]}")
19+fi
20+
21+for rbenvdir in "${rbenvdirs[@]}" ; do
22 if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then
23 FOUND_RBENV=1
24 export RBENV_ROOT=$rbenvdir