1#!/bin/bash 2# Copyright 2021 The gRPC Authors 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16# Source this rc script to load RVM and prepare the ruby environment 17# for building ruby artifacts. 18 19# sourcing rvm can generate a failure and we don't want to quit there 20set +ex 21# Look for rvm either in /etc/profile.d or in $HOME 22# shellcheck disable=SC1091 23[[ -s /etc/profile.d/rvm.sh ]] && source /etc/profile.d/rvm.sh 24# shellcheck disable=SC1090 25[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 26 27# rvm commands are very verbose and we dont want to pollute the log by echo, 28# but we want to exit if there's a failure 29set -e 30 31RUBY_VERSION=3.4.1 32echo "Installing ruby-${RUBY_VERSION}" 33time rvm install "ruby-${RUBY_VERSION}" 34echo "Setting default ruby version." 35rvm use "$RUBY_VERSION" --default 36 37# restore the original echo and exit on failure behavior 38set -ex 39 40# print current ruby version to log 41ruby --version 42 43# Bundler is required for grpc ruby artifact build. 44gem install bundler -v 2.6 45 46# log gem versions for easier debugging if things go wrong 47gem list || true 48