Class: Drupid::DownloadStrategy::CurlApacheMirror
- Defined in:
- lib/drupid/download_strategy.rb
Overview
Detect and download from Apache Mirror
Instance Attribute Summary
Attributes inherited from Curl
Attributes inherited from Base
#dest, #name, #staged_path, #url
Instance Method Summary collapse
Methods inherited from Curl
Methods inherited from Base
Methods included from Utils
#blah, #bzr, #compare_paths, #curl, #cvs, #debug, #dont_debug, #git, #hg, #ignore_interrupts, #interactive_shell, #odie, #ofail, #ohai, #owarn, #runBabyRun, #svn, #tempdir, #uncompress, #which, #writeFile
Constructor Details
This class inherits a constructor from Drupid::DownloadStrategy::Curl
Instance Method Details
#_fetch ⇒ Object
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/drupid/download_strategy.rb', line 234 def _fetch # Fetch mirror list site require 'open-uri' mirror_list = open(@url).read() # Parse out suggested mirror # Yep, this is ghetto, grep the first <strong></strong> element content mirror_url = mirror_list[/<strong>([^<]+)/, 1] raise "Couldn't determine mirror. Try again later." if mirror_url.nil? blah "Best Mirror #{mirror_url}" # Start download from that mirror curl mirror_url, '-o', @tarball_path end |