#!/bin/bash
# This file was generated on 2019-01-03T20:34:23+00:00 from the rspec-dev repo.
# DO NOT modify it by hand as your changes will get lost the next time it is generated.

set -e

function is_ruby_31_plus {
  if ruby -e "exit(RUBY_VERSION.to_f >= 3.1)"; then
    return 0
  else
    return 1
  fi
}

function is_ruby_23_plus {
  if ruby -e "exit(RUBY_VERSION.to_f >= 2.3)"; then
    return 0
  else
    return 1
  fi
}

if is_ruby_31_plus; then
  echo "Installing rubygems 3.3.6 / bundler 2.3.6"
  yes | gem update --system '3.3.6'
  yes | gem install bundler -v '2.3.6'
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
