diff --git a/macos/runtime_setup_stages/install_gems.sh b/macos/runtime_setup_stages/install_gems.sh index 501cd16..25f0bab 100755 --- a/macos/runtime_setup_stages/install_gems.sh +++ b/macos/runtime_setup_stages/install_gems.sh @@ -4,13 +4,16 @@ ROOTDIR=$(dirname "$0") ROOTDIR=$(cd "$ROOTDIR/../.." && pwd) source "$ROOTDIR/shared/lib/library.sh" -RUBY_VERSIONS=($(cat "$ROOTDIR/shared/definitions/ruby_versions")) +read -ra RUBY_VERSIONS < "$ROOTDIR/shared/definitions/ruby_versions" LAST_RUBY_VERSION=${RUBY_VERSIONS[${#RUBY_VERSIONS[@]} - 1]} if [[ -e /usr/local/rvm/bin/rvm-exec ]]; then RVM_EXEC=/usr/local/rvm/bin/rvm-exec elif [[ -e $HOME/.rvm/bin/rvm-exec ]]; then RVM_EXEC=$HOME/.rvm/bin/rvm-exec +elif [ "${GITHUB_ACTIONS:-false}" = 'true' ]; then + \curl -sSL https://get.rvm.io | bash + RVM_EXEC=$HOME/.rvm/bin/rvm-exec else echo "*** ERROR: you must have RVM installed" exit 1 @@ -27,6 +30,8 @@ ALL_RUBIES_OK=true for RUBY_VERSION in "${RUBY_VERSIONS[@]}"; do if run_ruby "$RUBY_VERSION" ruby -v &>/dev/null; then echo "Ruby $RUBY_VERSION: ok" + elif [ "${GITHUB_ACTIONS:-false}" = 'true' ]; then + rvm install "ruby-$RUBY_VERSION" else echo "Ruby $RUBY_VERSION: NOT INSTALLED! Please install it!" ALL_RUBIES_OK=false