Class: Jetel::Downloaders::Curl
- Inherits:
-
BaseDownloader
- Object
- BaseDownloader
- Jetel::Downloaders::Curl
- Defined in:
- lib/jetel/downloaders/curl/curl.rb
Constant Summary
Constants inherited from BaseDownloader
BaseDownloader::DATA_DIRECTORY, BaseDownloader::OPTS_DOWNLOAD
Instance Method Summary collapse
Instance Method Details
#download(url, opts = BaseDownloader::OPTS_DOWNLOAD) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jetel/downloaders/curl/curl.rb', line 10 def download(url, opts = BaseDownloader::OPTS_DOWNLOAD) super $stdout.sync = true opts = BaseDownloader::OPTS_DOWNLOAD.merge(opts) filename = opts[:filename] || url.split('/').last cmd = "curl -o \"#{File.join(opts[:dir], filename)}\" #{url}" puts(cmd) PTY.spawn(cmd) do |stdout, stdin, pid| begin # Do stuff with the output here. Just printing to show it works stdout.each { |line| print line } end end end |