Skip to content

Instantly share code, notes, and snippets.

@OwenMcDonnell
Last active February 23, 2024 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OwenMcDonnell/c63da7c5ba8508c219df01a503f57565 to your computer and use it in GitHub Desktop.
Save OwenMcDonnell/c63da7c5ba8508c219df01a503f57565 to your computer and use it in GitHub Desktop.
wrap rvm calls to rbenv
#!/bin/bash
USE=$1
VERSION=$2
OPTIONS=$3
COUNT="${VERSION//[^.]}"
echo "dot count: ${#COUNT}"
# cut version down if necessary
if [ ${#COUNT} == 2 ]; then
echo "shortening version..."
VERSION="${VERSION%.*}"
fi
declare -A RubyVersions
RubyVersions[2.1]=2.1.10
RubyVersions[2.2]=2.2.10
RubyVersions[2.3]=2.3.8
RubyVersions[2.4]=2.4.10
RubyVersions[2.5]=2.5.9
RubyVersions[2.6]=2.6.10
RubyVersions[2.7]=2.7.8
RubyVersions[3.0]=3.0.6
RubyVersions[3.1]=3.1.4
RubyVersions[3.2]=3.2.3
if [[ -v RubyVersions[$VERSION] ]]; then
echo "Ruby version found: ${RubyVersions[$VERSION]}"
else
echo "Ruby version not installed."
exit 1
fi
echo "${RubyVersions[$VERSION]}"
pushd $APPVEYOR_BUILD_FOLDER
~/.rbenv/bin/rbenv local ${RubyVersions[$VERSION]}
echo "rbenv local ${RubyVersions[$VERSION]}"
~/.rbenv/bin/rbenv versions
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment