RBENV_DIR sets the directory from which .rbenv-version files are scanned

This commit is contained in:
Sam Stephenson 2011-09-27 15:50:39 -05:00
parent a3deeba0a0
commit 07815769ae
3 changed files with 9 additions and 7 deletions

View file

@ -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 "$@"

View file

@ -27,6 +27,11 @@ else
fi
export RBENV_ROOT
if [ -z "${RBENV_DIR}" ]; then
RBENV_DIR="$(pwd)"
fi
export RBENV_DIR
shopt -s nullglob

View 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"