#!/usr/bin/env ruby
# Erik Kastner -- eznews speed downloader. Make sure u have axel (http://freshmeat.net/projects/axel/)
# You also need to have two envrionment variables set (EZNEWS_USER and EZNEWS_PASS)
# I just toss them in .eznews_creds and source it from .bash_profile
url =ARGV[0]
user =ENV["EZNEWS_USER"]
pass =ENV["EZNEWS_PASS"]raise"You must supply a url"unless url
raise"You must have EZNEWS-USER and EZNEWS-PASS in the envrionment"unless user && pass
url = url.gsub(/^http:\/\//,"http://#{user}:#{pass}@")
command ="axel -a -n 6 #{url}"
exec *command.split("")