backport of new rubygems version from master