support/check_versions
#!/bin/bash
set -eu
actual_ruby_version=$(ruby --version)
if [[ "$actual_ruby_version" == *"jruby"* ]]; then
# Replace "-" from specified RUBY_VERSION string. Semaphore/rbenv version uses
# a dash, where `jruby --version` uses a space.
sanitized_ruby_version="${RUBY_VERSION//-/ }"
else
# Strip "-" from specified RUBY_VERSION string. Semaphore/rbenv version uses
# a dash, where `ruby --version` does not.
sanitized_ruby_version="${RUBY_VERSION//-}"
fi
if [[ "$actual_ruby_version" == *"$sanitized_ruby_version"* ]]; then
echo "Ruby version is $RUBY_VERSION"
exit 0
else
echo "Ruby version is: $actual_ruby_version"
echo "Ruby version should be: $sanitized_ruby_version"
exit 1
fi