From fd6d48fef189d1c0dc819b13f70e2d04734b671a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Sat, 10 Oct 2015 20:11:08 +0200 Subject: [PATCH] Fix invoking `rbenv update` from rbenv-sh-update 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. --- bin/rbenv-sh-update | 4 ++-- bin/rbenv-update | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/rbenv-sh-update b/bin/rbenv-sh-update index 2678028..5034782 100755 --- a/bin/rbenv-sh-update +++ b/bin/rbenv-sh-update @@ -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"' diff --git a/bin/rbenv-update b/bin/rbenv-update index 1373e2b..9225b8a 100755 --- a/bin/rbenv-update +++ b/bin/rbenv-update @@ -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