2011-08-12 05:33:45 -04:00
|
|
|
#!/usr/bin/env bash
|
2012-12-29 17:34:53 -05:00
|
|
|
# Summary: Show the current Ruby version and its origin
|
|
|
|
#
|
2012-12-29 23:05:04 -05:00
|
|
|
# Shows the currently selected Ruby version and how it was
|
|
|
|
# selected. To obtain only the version string, use `rbenv
|
|
|
|
# version-name'.
|
2012-12-29 13:06:20 -05:00
|
|
|
|
2011-08-12 05:33:45 -04:00
|
|
|
set -e
|
2011-09-12 11:11:59 -04:00
|
|
|
[ -n "$RBENV_DEBUG" ] && set -x
|
2011-08-01 16:50:26 -04:00
|
|
|
|
2020-01-16 10:15:09 -05:00
|
|
|
version_name="$(rbenv-version-name)"
|
|
|
|
version_origin="$(rbenv-version-origin)"
|
|
|
|
|
|
|
|
if [ "$version_origin" = "${RBENV_ROOT}/version" ] && [ ! -e "$version_origin" ]; then
|
|
|
|
echo "$version_name"
|
2020-01-08 03:40:48 -05:00
|
|
|
else
|
2020-01-16 10:15:09 -05:00
|
|
|
echo "$version_name (set by $version_origin)"
|
2020-01-08 02:54:33 -05:00
|
|
|
fi
|