Global version file is now ${RBENV_ROOT}/version

This is the last time it'll change. Promise.
This commit is contained in:
Sam Stephenson 2011-09-28 09:45:58 -05:00
parent 65bf6279fa
commit 0a4ffcd15f
3 changed files with 12 additions and 10 deletions

4
.gitignore vendored
View file

@ -1,3 +1,3 @@
/versions
/shims /shims
/global /version
/versions

View file

@ -9,12 +9,13 @@ if [ "$1" = "--complete" ]; then
fi fi
RBENV_VERSION="$1" RBENV_VERSION="$1"
RBENV_VERSION_FILE="${RBENV_ROOT}/global" RBENV_VERSION_FILE="${RBENV_ROOT}/version"
if [ -n "$RBENV_VERSION" ]; then if [ -n "$RBENV_VERSION" ]; then
rbenv-version-file-write "$RBENV_VERSION_FILE" "$RBENV_VERSION" rbenv-version-file-write "$RBENV_VERSION_FILE" "$RBENV_VERSION"
else else
rbenv-version-file-read "$RBENV_VERSION_FILE" || rbenv-version-file-read "$RBENV_VERSION_FILE" ||
rbenv-version-file-read "${RBENV_ROOT}/global" ||
rbenv-version-file-read "${RBENV_ROOT}/default" || rbenv-version-file-read "${RBENV_ROOT}/default" ||
echo system echo system
fi fi

View file

@ -11,13 +11,14 @@ while [ -n "$root" ]; do
root="${root%/*}" root="${root%/*}"
done done
GLOBAL_PATH="${RBENV_ROOT}/global" global_version_file="${RBENV_ROOT}/version"
DEFAULT_PATH="${RBENV_ROOT}/default"
if [ -e "$GLOBAL_PATH" ]; then if [ -e "$global_version_file" ]; then
echo "$GLOBAL_PATH" echo "$global_version_file"
elif [ -e "$DEFAULT_PATH" ]; then elif [ -e "${RBENV_ROOT}/global" ]; then
echo "$DEFAULT_PATH" echo "${RBENV_ROOT}/global"
elif [ -e "${RBENV_ROOT}/default" ]; then
echo "${RBENV_ROOT}/default"
else else
echo "$GLOBAL_PATH" echo "$global_version_file"
fi fi