Add rubygems_validate()

Stolen from @raggi adapted for RVM.
Merge pull request #1489 from envygeeks/patch-1

Add rubygems_validate()
cleaning rubygems_validate
avoid extra checks when globalcache is enabled
fix double cache, improve output