lib/bukkit/download.rb in bukkit-2.0.0 vs lib/bukkit/download.rb in bukkit-2.1.0
- old
+ new
@@ -1,6 +1,6 @@
-require 'curb'
+require 'rest-client'
module Bukkit
class Server
# Download a file from a URI.
def self.download(uri, options = {}) # Options: { :filename => "filename.ext" }
@@ -12,18 +12,15 @@
end
# Give some friendly output.
puts "Downloading: ".yellow + filename
puts " From: ".yellow + uri
+ puts "(This may take a while depending on your internet connection.)".light_yellow
# Download the file.
- data = Curl::Easy.perform(uri)
- data.follow_location = true
- data.max_redirects = 8
- data.useragent = "curb"
- data.perform
+ data = RestClient.get(uri)
File.open(filename, "wb") do |file|
- file.write(data.body_str)
+ file.write(data)
end
# => filename.ext
puts filename.light_green + " successfully downloaded!".green
end
\ No newline at end of file