#!/usr/bin/env bash set -e [[ -z "$VERSION" ]] && VERSION=2.1.3 [[ -z "$INSTALLER_ROOT" ]] && INSTALLER_ROOT="$HOME/.tmprbenvinstaller" # Create the rbenv directory structure if it doesn't already exist. mkdir -p "$INSTALLER_ROOT" cd "$INSTALLER_ROOT" # Download the requested version of rbenv-ruby-install echo "*** Downloading rbenv-ruby-install/v$VERSION ***" curl -skSfL "https://github.com/goodtouch/rbenv-ruby-install/tarball/v$VERSION" | tar xz -m --strip 1 # Remove .rbenv-version if present [[ -f ./.rbenv-version ]] && rm -rf ./.rbenv-version # Launch the installer ./install # Remove tmp file cd rm -rf "$INSTALLER_ROOT"