From 07815769aeda3097f43d032fb31f6c89d1a7942f Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Tue, 27 Sep 2011 15:50:39 -0500 Subject: [PATCH] RBENV_DIR sets the directory from which .rbenv-version files are scanned --- bin/ruby-local-exec | 9 +++------ libexec/rbenv | 5 +++++ libexec/rbenv-version-file | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) 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"