FindRuby: update to support versions up to 3.1 and fix a binary scanning bug
This PR updates the FindRuby module to support newer versions, up to 3.1.
Additionally it fixes a binary scanning bug, as described here:
The possible executable names list always starts with a plain ruby
binary, which is scanned for first. If that does exist (which satisfies find_program
), but doesn't match the requested version, the executable will be dismissed by _RUBY_VALIDATE_INTERPRETER
(which is sane), but searching also stops.
Fix that by keeping the search going, removing items from the list as we go, until find_program
returns a path that _RUBY_VALIDATE_INTERPRETER
is happy with or the list is empty.