Add rubygems_validate()

Stolen from @raggi, adapted for RVM.