use typeset instead of type, update 290d0140cf5a56c47c61f521b90ada07b1caea89, update #2628
do not install rubygems if latest version already installed, fix #2630
cleaning rubygems installation