27 lines · 1.0 KB · ShellRaw
#!/usr/bin/env bash# The scripts suite executes the Fastfile's signing-lock logic with Ruby's# standard library. CI's non-login PATH omits rbenv even when Ruby is installed.# Activate that interpreter for the job; never silently skip the guard.set -euo pipefailruby=""if [ "$#" -gt 0 ]; then [ "$#" -eq 2 ] && [ "$1" = --rbenv ] || { echo "usage: $0 [--rbenv <root>]" >&2; exit 2; } roots=("$2")else ruby="$(command -v ruby || true)" roots=("${RBENV_ROOT:-$HOME/.rbenv}" /opt/rbenv /opt/homebrew/opt/rbenv)fiif [ -z "$ruby" ]; then for root in "${roots[@]}"; do [ -x "$root/bin/rbenv" ] || continue candidate="$(RBENV_ROOT="$root" "$root/bin/rbenv" which ruby 2>/dev/null || true)" if [ -n "$candidate" ] && [ -x "$candidate" ]; then ruby="$candidate"; break; fi donefiif [ -z "$ruby" ]; then echo "::error::Ruby is required for the script signing-lock guard; install Ruby on this runner or name its rbenv root." >&2 exit 1fi"$ruby" --versionprintf '%s\n' "$(dirname "$ruby")" >> "${GITHUB_PATH:-/dev/null}"echo "test-ruby: $ruby"