module DownUniverse::Downloadable
Public Instance Methods
http_download(url, output, user=nil, password=nil)
click to toggle source
Public: Downloads a given HTTP url with 'wget'.
url - The url to be downloaded. That should respond to to_str. output - Name and path of the output file. user - set both ftp and http user(Optional). password - set both ftp and http password(Optional).
Returns boolean
Examples
http_download
('test.com/som_file.iso', '/Users/test/file.iso') # => true
http_download
('test.com/som_file.iso', '/Users/test/file.iso') # => false
# File lib/down_universe.rb, line 23 def http_download(url, output, user=nil, password=nil) command = "wget -O #{output}" command += " --user=#{user}" unless user.nil? command += " --password=#{password}" unless password.nil? command += " #{url.to_str}" SafeShell.execute! command end