Class: Gravaty::Utils::Downloader::Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/gravaty/utils/downloader.rb

Overview

!/usr/bin/env ruby

An HTTP/HTTPS/FTP file downloader library/CLI based upon MiniPortile’s HTTP implementation.

Author

Jon Maken

License

3-clause BSD

Revision

2012-03-25 23:01:19 -0600

Constant Summary collapse

VERSION =
'0.1.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.ftp_data_chunk_sizeObject

Returns the value of attribute ftp_data_chunk_size.



51
52
53
# File 'lib/gravaty/utils/downloader.rb', line 51

def ftp_data_chunk_size
  @ftp_data_chunk_size
end

.loggerObject

Returns the value of attribute logger.



51
52
53
# File 'lib/gravaty/utils/downloader.rb', line 51

def logger
  @logger
end

.max_ca_verify_depthObject

Returns the value of attribute max_ca_verify_depth.



51
52
53
# File 'lib/gravaty/utils/downloader.rb', line 51

def max_ca_verify_depth
  @max_ca_verify_depth
end

Class Method Details

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

Raises:

  • (RuntimeError)


59
60
61
62
63
64
# File 'lib/gravaty/utils/downloader.rb', line 59

def self.download_file(url, full_path, count = 3)
  raise RuntimeError, I18n.t('error.nil') if url.nil?
  return if File.exist?(full_path)

  http_download(url, full_path, count)
end