2011-08-12 11:33:45 +02:00
|
|
|
#!/usr/bin/env bash
|
2012-12-29 23:34:53 +01:00
|
|
|
# Summary: Show the current Ruby version and its origin
|
|
|
|
#
|
2012-12-30 05:05:04 +01: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 19:06:20 +01:00
|
|
|
|
2011-08-12 11:33:45 +02:00
|
|
|
set -e
|
2011-09-12 17:11:59 +02:00
|
|
|
[ -n "$RBENV_DEBUG" ] && set -x
|
2011-08-01 22:50:26 +02:00
|
|
|
|
2020-01-16 16:15:09 +01: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 09:40:48 +01:00
|
|
|
else
|
2020-01-16 16:15:09 +01:00
|
|
|
echo "$version_name (set by $version_origin)"
|
2020-01-08 08:54:33 +01:00
|
|
|
fi
|