[Rubyinstaller-devel] [Fwd: Patch for Ruby Windows installer]

Andrew Hunt andy at pragmaticprogrammer.com
Mon Mar 29 14:12:28 EST 2004


Hi all -- got this morning, feel free to use or ignore as appropriate.

/\ndy

-----Forwarded Message-----

> From: "Weil, Stefan S-RD-AS5" <Stefan.Weil at heidelberg.com>
> To: andy at PragmaticProgrammer.com
> Subject: Patch for Ruby Windows installer
> Date: 29 Mar 2004 09:22:17 +0200
> 
> Hello,
> 
> below there is a small patch for your nice installer which makes
> life easier for people behind a firewall (who need a web proxy).
> 
> The patch reads the usual environment variable http_proxy and
> does not change anything if http_proxy is undefined.
> 
> Example:
> set http_proxy=http://myproxy:8080/
> nmake
> 
> Kind regards
> Stefan Weil
> 
> PS. Please do not use my mail address in public documents.
>     I do not like spam mails.
> 
> 
> 
> Index: builder/download.rb
> ===================================================================
> RCS file: /var/cvs/rubyinstaller/installer/builder/download.rb,v
> retrieving revision 1.1
> diff -u -r1.1 download.rb
> --- builder/download.rb 31 Jan 2004 07:45:28 -0000      1.1
> +++ builder/download.rb 29 Mar 2004 07:33:13 -0000                              @@ -19,7 +19,14 @@
>      end
>      
>      def httpGet(machine, dir, file)
> -      h = Net::HTTP.new(machine, 80)
> +      proxyurl = ENV['http_proxy']
> +      proxy = nil
> +      proxy_port = nil
> +      if proxyurl && proxyurl =~ /http:\/\/([^\/]+):([0-9]+)/
> +       proxy = $1
> +       proxy_port = $2
> +      end
> +      h = Net::HTTP.new(machine, 80, proxy, proxy_port)
>        target = "/" + dir + "/" + file + @extra
>        f = File.open(file, "wb")
>        data = h.get(target, nil) { |block|
-- 
Andrew Hunt, The Pragmatic Programmers, LLC.
Innovative Object-Oriented Software Development and Mentoring for Agile Methods
voice: 919-847-3884                         fax:   919-844-5133
web:   http://www.pragmaticprogrammer.com   email: andy at pragmaticprogrammer.com
--
Author of "The Pragmatic Programmer" * "Programming Ruby" * The Agile Manifesto
JOLT Productivity Award Winner: "Pragmatic Version Control" * "Pragmatic Unit Testing"
Columnist for IEEE Software Magazine * Board of Directors, Agile Alliance



More information about the Rubyinstaller-devel mailing list