Setting the verbose flag showed there was no network problem:
>gem install refile -V io/console not supported; tty will not be manipulated HEAD https://api.rubygems.org/api/v1/dependencies 200 OK GET https://api.rubygems.org/api/v1/dependencies?gems=refile 200 OK ERROR: While executing gem ... (ArgumentError) marshal data too short
In the end it turned out to be JRuby in Ruby 2.0 mode.
>jruby --1.9 -S gem install carrierwave io/console not supported; tty will not be manipulated Fetching: carrierwave-0.10.0.gem (100%) Successfully installed carrierwave-0.10.0 1 gem installed
I was trying to install refile to replace paperclip, which seems to be dodgy with Windows (requiring DevKit). Unfortunately, refile requires Ruby 2.1, so the gem cannot be downloaded with JRuby in 1.9 mode, and gem install does not work unless JRuby is in 1.9 mode. Great.
So I am looking at CarrierWave...