Wednesday, October 1, 2008

Install a Rails plugin, from Github, on Windows, behind an authenticated proxy

It's quite a series of hurdles....

For this to work, your app must be Rails 2.1+

1. In your shell session, set the http_proxy variable:
set http_proxy=http://user:password@proxyserver:port

Obviously you'll need to known your user, password, proxy and port. If you're not sure of proxy server and port, try typing wpad in the address bar in IE.

2. Download and install git for Windows from http://code.google.com/p/msysgit/

3. Hack open-uri.rb to allow authenticated proxy access

Change this:
if proxy
klass = Net::HTTP::Proxy(proxy.host, proxy.port)
end

to this:
if proxy
klass = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user, proxy.password)
end


On my installation, this was at line 215. Refer also to the issue logged here:
http://redmine.ruby-lang.org/issues/show/435

4. Download your plugin, for example...
ruby script\plugin install http://github.com/activescaffold/active_scaffold.git/


Note the http protocol (not git) and the trailing slash. Announcement about this Github feature here.

No comments: