Class: DownloadHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/ignition/helpers/download_helper.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.ftp_data_chunk_sizeObject

Returns the value of attribute ftp_data_chunk_size.



22
23
24
# File 'lib/ignition/helpers/download_helper.rb', line 22

def ftp_data_chunk_size
  @ftp_data_chunk_size
end

.loggerObject

Returns the value of attribute logger.



22
23
24
# File 'lib/ignition/helpers/download_helper.rb', line 22

def logger
  @logger
end

.max_ca_verify_depthObject

Returns the value of attribute max_ca_verify_depth.



22
23
24
# File 'lib/ignition/helpers/download_helper.rb', line 22

def max_ca_verify_depth
  @max_ca_verify_depth
end

Class Method Details

.download_file(url, full_path, count = 3) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ignition/helpers/download_helper.rb', line 30

def self.download_file(url, full_path, count = 3)
  return if File.exist?(full_path)

  uri = URI.parse(url)
  case uri.scheme.downcase
  when /ftp/
    ftp_download(uri, full_path)
  when /http|https/
    http_download(url, full_path, count)
  end
end