2011-08-18 19:11:40 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2011-09-12 15:11:59 +00:00
|
|
|
[ -n "$RBENV_DEBUG" ] && set -x
|
2011-08-18 19:11:40 +00:00
|
|
|
|
2011-09-27 20:50:39 +00:00
|
|
|
root="$RBENV_DIR"
|
2011-08-18 19:11:40 +00:00
|
|
|
while [ -n "$root" ]; do
|
|
|
|
if [ -e "${root}/.rbenv-version" ]; then
|
|
|
|
echo "${root}/.rbenv-version"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
root="${root%/*}"
|
|
|
|
done
|
|
|
|
|
2011-09-28 14:45:58 +00:00
|
|
|
global_version_file="${RBENV_ROOT}/version"
|
2011-08-18 19:32:33 +00:00
|
|
|
|
2011-09-28 14:45:58 +00:00
|
|
|
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"
|
2011-08-18 19:32:33 +00:00
|
|
|
else
|
2011-09-28 14:45:58 +00:00
|
|
|
echo "$global_version_file"
|
2011-08-18 19:32:33 +00:00
|
|
|
fi
|