views:

416

answers:

1

I'm a big fan of the ruby way. However today it got in my way.

The defacto way of installing rails (i'm running as a domain user on a WinXP machine) is

  • download and install ruby (one-click installer)
  • type >gem install rails at the command prompt

Step 2 fails with some function getaddrhost not able to function. Some googling taught me that this is a known issue - See Authenticating Windows Proxy Problems on the rubygems FAQ

The suggested options there to "use the -p or --http-proxy http://proxy:port " switch for gem install also didn't work any wonders.

There's a link to something that runs a server to get across the proxy server - but it looked like it would need python to be installed (??!!). So I gave that a miss.

I'm going to try to get the .gem files (after figuring out all the inter dependencies :( ) from ruby_home\lib\ruby\gems\1.8\cache on my rails-friendly home machine and USB-drive it across and do a local gem install. Does anyone have a less painful / quick way of bridging this divide?

Update: Day2. Okay so I have the gems available locally. However if I do a

>gem install activesupport-1.4.4 --local
ERROR:  Error installing gem activesupport-1.4.4[.gem]: undefined method `includ
e?' for nil:NilClass

I've tried ruby once click installer for windows for 186-27 RC2 and 186-26 Final release. Same issue. More googling led to "In case you're having trouble installing gems...". The latest workaround is to: delete the source_cache file in your GEM PATH folder shown by gem env, then do a gem update --system. and of course proxy server gets in the way of Step 2.

Is this issue with gems fixed in some later release that I can download ?

+3  A: 

Well another battle ends.. with a victory. Turns out the proxy server can be specified after all. However the documented -p and --http-proxy command line switches don't work for some reason or I wasn't smart enough to figure out the right incantation.

>ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
>gem -v
1.3.5 
>gem query -p http
ERROR:  While executing gem ... (OptionParser::InvalidArgument)
    invalid argument: -p http

Just for trying everything I could I tried setting the HTTP_PROXY environment variable on the windows command line as mentioned in the WolfByte's answer to this SO question (that i stumbled upon after search keyword bingo on google). AND IT WORKED!!!

>SET HTTP_PROXY=http://username:password@proxy:port
>gem update --system
>gem install rails

Guess SO needs a new tag-line "The answer is in there" ala XFiles. You just need to wrestle with Google to get to it. Hope this helps the next person

Gishu