2011-08-18 19:11:40 +00:00
|
|
|
#!/usr/bin/env bash
|
2012-12-30 04:05:04 +00:00
|
|
|
# Usage: rbenv version-file-write <file> <version>
|
2012-12-29 22:34:53 +00:00
|
|
|
|
2011-08-18 19:11:40 +00:00
|
|
|
set -e
|
2011-09-12 15:11:59 +00:00
|
|
|
[ -n "$RBENV_DEBUG" ] && set -x
|
2011-08-18 19:11:40 +00:00
|
|
|
|
|
|
|
RBENV_VERSION_FILE="$1"
|
|
|
|
RBENV_VERSION="$2"
|
|
|
|
|
|
|
|
if [ -z "$RBENV_VERSION" ] || [ -z "$RBENV_VERSION_FILE" ]; then
|
2012-12-29 22:34:53 +00:00
|
|
|
rbenv-help --usage version-file-write >&2
|
2011-08-18 20:28:35 +00:00
|
|
|
exit 1
|
2011-08-18 19:11:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Make sure the specified version is installed.
|
|
|
|
rbenv-prefix "$RBENV_VERSION" >/dev/null
|
|
|
|
|
|
|
|
# Write the version out to disk.
|
|
|
|
echo "$RBENV_VERSION" > "$RBENV_VERSION_FILE"
|