2011-09-11 00:45:22 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2011-09-12 15:11:59 +00:00
|
|
|
[ -n "$RBENV_DEBUG" ] && set -x
|
2011-09-09 12:18:14 +00:00
|
|
|
|
2011-09-11 00:45:22 +00:00
|
|
|
version="$1"
|
|
|
|
|
|
|
|
if [ -z "$version" ]; then
|
|
|
|
if [ -z "$RBENV_VERSION" ]; then
|
|
|
|
echo "rbenv: no shell-specific version configured" >&2
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "echo \"\$RBENV_VERSION\""
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$version" = "--unset" ]; then
|
|
|
|
echo "unset RBENV_VERSION"
|
2011-09-09 12:18:14 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2011-09-11 00:45:22 +00:00
|
|
|
# Make sure the specified version is installed.
|
|
|
|
rbenv-prefix "$version" >/dev/null
|
2011-09-09 12:18:14 +00:00
|
|
|
|
2011-09-11 00:45:22 +00:00
|
|
|
echo "export RBENV_VERSION=\"${version}\""
|