Class: Torba::RemoteSources::GetFile
- Inherits:
-
Object
- Object
- Torba::RemoteSources::GetFile
- Defined in:
- lib/torba/remote_sources/get_file.rb
Overview
File downloading abstraction
Class Method Summary collapse
-
.process(url) ⇒ Tempfile
Temporarily stored content of the URL.
Class Method Details
.process(url) ⇒ Tempfile
Returns temporarily stored content of the URL.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/torba/remote_sources/get_file.rb', line 11 def self.process(url) tempfile = Tempfile.new("torba") tempfile.close Torba.ui.info "downloading '#{url}'" command = "curl --retry 5 --retry-max-time 60 -Lf -o #{tempfile.path} #{url}" system(command) || raise(Errors::ShellCommandFailed.new(command)) tempfile end |