2011-08-12 09:33:45 +00:00
|
|
|
#!/usr/bin/env bash
|
2012-12-29 22:34:53 +00:00
|
|
|
# Summary: Show the current Ruby version
|
2011-08-12 09:33:45 +00:00
|
|
|
set -e
|
2011-09-12 15:11:59 +00:00
|
|
|
[ -n "$RBENV_DEBUG" ] && set -x
|
2011-08-09 20:41:35 +00:00
|
|
|
|
|
|
|
if [ -z "$RBENV_VERSION" ]; then
|
2011-08-18 19:11:40 +00:00
|
|
|
RBENV_VERSION_FILE="$(rbenv-version-file)"
|
|
|
|
RBENV_VERSION="$(rbenv-version-file-read "$RBENV_VERSION_FILE" || true)"
|
2011-08-09 20:41:35 +00:00
|
|
|
fi
|
|
|
|
|
2011-09-09 20:52:31 +00:00
|
|
|
if [ -z "$RBENV_VERSION" ] || [ "$RBENV_VERSION" = "system" ]; then
|
|
|
|
echo "system"
|
2011-08-09 20:41:35 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2011-09-11 16:58:57 +00:00
|
|
|
RBENV_VERSION_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}"
|
2011-08-09 20:41:35 +00:00
|
|
|
|
|
|
|
if [ -d "$RBENV_VERSION_PATH" ]; then
|
|
|
|
echo "$RBENV_VERSION"
|
|
|
|
else
|
|
|
|
echo "rbenv: version \`$RBENV_VERSION' is not installed" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|