diff --git a/bin/ruby-local-exec b/bin/ruby-local-exec index af7d7e1a..b1b5a5fa 100755 --- a/bin/ruby-local-exec +++ b/bin/ruby-local-exec @@ -13,11 +13,8 @@ set -e -cwd="$(pwd)" -dirname="${1%/*}" - -cd "$dirname" -export RBENV_VERSION="$(rbenv version-name)" -cd "$cwd" +if [ -z "$RBENV_DIR" ]; then + export RBENV_DIR="${1%/*}" +fi exec ruby "$@" diff --git a/libexec/rbenv b/libexec/rbenv index 2c00d7d7..f6b07b92 100755 --- a/libexec/rbenv +++ b/libexec/rbenv @@ -27,6 +27,11 @@ else fi export RBENV_ROOT +if [ -z "${RBENV_DIR}" ]; then + RBENV_DIR="$(pwd)" +fi +export RBENV_DIR + shopt -s nullglob diff --git a/libexec/rbenv-version-file b/libexec/rbenv-version-file index eb72ec38..31b8670d 100755 --- a/libexec/rbenv-version-file +++ b/libexec/rbenv-version-file @@ -2,7 +2,7 @@ set -e [ -n "$RBENV_DEBUG" ] && set -x -root="$(pwd)" +root="$RBENV_DIR" while [ -n "$root" ]; do if [ -e "${root}/.rbenv-version" ]; then echo "${root}/.rbenv-version"