Make sure, ruby and bundler are available

This commit is contained in:
Andreas Dangel
2024-02-15 20:44:07 +01:00
parent aa6851e2d2
commit 04509a9fba

View File

@ -17,6 +17,30 @@ if [ ! -f pom.xml ] || [ ! -d ../pmd.github.io ]; then
exit 1 exit 1
fi fi
#
# Make sure, we have ruby and bundler available
#
set +e # don't stop for error "command not found" - it is handled
ruby_version_full=$(ruby --version 2>&1)
ruby_version=$(echo "${ruby_version_full}" | grep "ruby 3" | head -1 2>&1)
if [ $? -eq 0 ] && [ -n "${ruby_version}" ]; then
echo "Using ${ruby_version_full}"
else
echo "Wrong ruby version! Expected ruby 3"
echo "${ruby_version_full}"
exit 1
fi
bundler_version=$(bundler --version 2>&1)
if [ $? -eq 0 ]; then
echo "Using ${bundler_version}"
else
echo "Missing bundler!"
echo "${bundler_version}"
exit 1
fi
# abort the script on the first failing sub command
set -e
CURRENT_BRANCH= CURRENT_BRANCH=
echo "-------------------------------------------" echo "-------------------------------------------"