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 and its origin
|
|
|
|
#
|
2012-12-30 04:05:04 +00: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 18:06:20 +00:00
|
|
|
|
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-01 20:50:26 +00:00
|
|
|
|
2020-01-16 15:15:09 +00: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 08:40:48 +00:00
|
|
|
else
|
2020-01-16 15:15:09 +00:00
|
|
|
echo "$version_name (set by $version_origin)"
|
2020-01-08 07:54:33 +00:00
|
|
|
fi
|