how to get rpm file with ruby ?

J

Jedrin

Neither of the methods below are able to download this rpm file. If
you use firefox it works fine, how can I do this in ruby as part of a
install script I am trying to write in ruby ?

--------------------

require 'net/http'

Net::HTTP.start("apt.sw.be") { |http|
resp = http.get("/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-
release-0.3.6-1.el5.rf.x86_64.rpm")
open("postgis.rpm", "wb") { |file|
file.write(resp.body)
}
}

##########################

open('http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-
release-0.3.6-1.el5.rf.x86_64.rpm')
 
B

Brian Candler

Jedrin said:
Neither of the methods below are able to download this rpm file.

Please post the exact error message you see (or other symptom - e.g.
does it hang? do you see a zero-byte file? something else?)

It looks all right to me. In irb:
require 'net/http' => true
resp = Net::HTTP.start("apt.sw.be") { |http| http.get("/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm") }
=> # said:
resp.body.size => 16697
resp['Content-Type'] => "application/x-redhat-package-manager"
RUBY_DESCRIPTION
=> "ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]"

Perhaps you are behind a proxy or something, and you have firefox
configured to use that proxy?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top