For implementations like Rubinius that can run from a source directory without installing and which do not overwrite gem binary wrappers in system directories, it is possible to invoke the Rakefile with eg 'rbx -S rake spec' while the system Ruby is on PATH as 'ruby' and 'gem'. This results in the system Ruby running the rake subprocesses instead of Rubinius as intended. These changes use Gem.ruby, which returns the path to the Ruby implementation running rake and use -S to search for the gem bin wrapper on PATH. Rubinius prepends distinguished directories when processing -S so that gems installed into Rubinius are found first. The explicit requiring of rubygems may be controversial. Evan said it was ok but the rest of the changes stand on their own if it's desirable to remove the require.
…a Rubygems checkout