improve handling rubygems setup for ruby installation, add more debugging, fix #2381