#!/bin/bash set -eo pipefail cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" versions=( "$@" ) if [ ${#versions[@]} -eq 0 ]; then versions=( */ ) fi versions=( "${versions[@]%/}" ) releasePage="$(curl -fsSL 'https://www.ruby-lang.org/en/downloads/releases/')" latest_gem_version() { curl -fsSL "https://rubygems.org/api/v1/gems/$1.json" | sed -r 's/^.*"version":"([^"]+)".*$/\1/' } rubygems="$(latest_gem_version rubygems-update)" bundler="$(latest_gem_version bundler)" travisEnv= for version in "${versions[@]}"; do rcGrepV='-v' rcVersion="${version%-rc}" if [ "$rcVersion" != "$version" ]; then rcGrepV= fi IFS=$'\n'; allVersions=( $(curl -fsSL --compressed "https://cache.ruby-lang.org/pub/ruby/$rcVersion/" \ | grep -E '&2 "warning: cannot determine sha for $version (tried all of ${allVersions[*]}); skipping" continue fi versionReleasePage="$(echo "$releasePage" | grep "