Skip to content

Commit

Permalink
Fix invoking rbenv update from rbenv-sh-update
Browse files Browse the repository at this point in the history
It's not a good idea to invoke `rbenv-update` executable with absolute
path because that bypasses rbenv. Instead, `command rbenv update` does
the trick and ensures that RBENV_ROOT will always be available.
  • Loading branch information
mislav committed Oct 10, 2015
1 parent a7bf727 commit fd6d48f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bin/rbenv-sh-update
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ shell="$(basename "${RBENV_SHELL:-$SHELL}")"

case "$shell" in
fish )
echo -n "$(which rbenv-update); and "
echo -n "command rbenv update; and "
echo -n 'echo -e "\033[1;32mreloading rbenv\033[0m"; and '
echo -n '. (rbenv init - | psub); and '
echo -n 'echo -e " \033[1;32m|\033[0m done"'
;;
* )
echo -n "$(which rbenv-update) && "
echo -n "command rbenv update && "
echo -n 'echo -e "\033[1;32mreloading rbenv\033[0m" && '
echo -n 'eval "$(rbenv init -)" && '
echo -n 'echo -e " \033[1;32m|\033[0m done"'
Expand Down
3 changes: 1 addition & 2 deletions bin/rbenv-update
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ rbenv_update() {
cd "$(dirname $(which rbenv))"
rbenv_update rbenv

cd "${RBENV_ROOT:-$(rbenv root)}"
for plugin in plugins/*; do
for plugin in "$RBENV_ROOT"/plugins/*; do
pushd $plugin >/dev/null
rbenv_update `basename $plugin`
popd >/dev/null
Expand Down

0 comments on commit fd6d48f

Please sign in to comment.