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
/global
/version
/versions

View file

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

View file

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