deps: fix Bundler version detection in case Gem version syntax fails
What does this Merge Request do?
Gem binaries usually support choosing an explicit version via the syntax
$GEM _$VERSION_ $ARGS
, which we started to use in commit f49d72d2 (Fix
bundler detection, 2019-10-29) to detect if the correct Bundler version
is installed in case there are multiple versions available.
Unfortunately, this detection fails on some systems which patch Ruby Gem
executables with a custom binary wrapper, like it is the case with
Gentoo Linux. As a result, the Gem version syntax will fail.
Fix detection on such systems by doing a hybrid of the previous and
current detection code: In case bundle --version
doesn't emit the
desired version, we will fall back and test whether bundle _$VERSION --version
succeeds.
Merge Request checklist
-
Tests added for new functionality. If not, please raise Issue to follow-up. -
This change is backward compatible. If not, please include steps to communicate to our users. -
Documentation added/updated, if needed. -
gdk doctor
test added, if needed.