Class: Fig::Protocol::HTTP

Inherits:
Object
  • Object
show all
Includes:
Fig::Protocol
Defined in:
lib/fig/protocol/http.rb

Overview

File transfers via HTTP.

Instance Method Summary collapse

Methods included from Fig::Protocol

#download_list, #path_up_to_date?, #upload

Instance Method Details

#download(uri, path, prompt_for_login) ⇒ Object

Returns whether the file was not downloaded because the file already exists and is already up-to-date.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fig/protocol/http.rb', line 20

def download(uri, path, )
  log_download(uri, path)
  ::File.open(path, 'wb') do |file|
    file.binmode

    begin
      download_via_http_get(uri, file)
    rescue SystemCallError => error
      Fig::Logging.debug error.message
      raise Fig::FileNotFoundError.new error.message, uri
    rescue SocketError => error
      Fig::Logging.debug error.message
      raise Fig::FileNotFoundError.new error.message, uri
    end
  end
end