set -e

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/functions.sh

if is_ruby_31_plus; then
  echo "Installing most recent rubygems / bundler"
  yes | gem update --no-document --system
  yes | gem install --no-document bundler
elif is_ruby_23_plus; then
  echo "Installing rubygems 3.2.22 / bundler 2.2.22"
  yes | gem update --system '3.2.22'
  yes | gem install bundler -v '2.2.22'
else
  echo "Warning installing older versions of Rubygems / Bundler"
  gem update --system '2.7.8'
  gem install bundler -v '1.17.3'
fi
