def download(hit_network = false)
return if File.exist?(binary_path) && !hit_network
raise "Version not found for #{download_version}" unless download_url
filename = File.basename download_url
Dir.chdir platform_install_dir do
FileUtils.rm_f filename
File.open(filename, "wb") do |saved_file|
URI.parse(download_url).open("rb") do |read_file|
saved_file.write(read_file.read)
end
end
raise "Could not download #{download_url}" unless File.exists? filename
Archive::Zip.extract(filename, '.', :overwrite => :all)
end
raise "Could not unzip #{filename} to get #{binary_path}" unless File.exists? binary_path
FileUtils.chmod "ugo+rx", binary_path
File.open(version_path, 'w') { |file| file.write(download_version) }
end