Class: Jekyll::RemoteTheme::Downloader
- Inherits:
-
Object
- Object
- Jekyll::RemoteTheme::Downloader
- Defined in:
- lib/jekyll-remote-theme/downloader.rb
Constant Summary collapse
- PROJECT_URL =
"https://github.com/benbalter/jekyll-remote-theme"- USER_AGENT =
"Jekyll Remote Theme/#{VERSION} (+#{PROJECT_URL})"- MAX_FILE_SIZE =
Size in bytes (1 GB)
1 * (1024 * 1024 * 1024)
- NET_HTTP_ERRORS =
[ Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::OpenTimeout, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, OpenSSL::SSL::SSLError, ].freeze
Instance Method Summary collapse
- #downloaded? ⇒ Boolean
-
#initialize(theme) ⇒ Downloader
constructor
A new instance of Downloader.
- #run ⇒ Object
Constructor Details
#initialize(theme) ⇒ Downloader
Returns a new instance of Downloader.
15 16 17 |
# File 'lib/jekyll-remote-theme/downloader.rb', line 15 def initialize(theme) @theme = theme end |
Instance Method Details
#downloaded? ⇒ Boolean
34 35 36 37 38 |
# File 'lib/jekyll-remote-theme/downloader.rb', line 34 def downloaded? return true if theme.local_theme? @downloaded ||= theme_dir_exists? && !theme_dir_empty? end |
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/jekyll-remote-theme/downloader.rb', line 19 def run if theme.local_theme? Jekyll.logger.debug LOG_KEY, "Using local theme at #{theme.root}" return end if downloaded? Jekyll.logger.debug LOG_KEY, "Using existing #{theme.name_with_owner}" return end download unzip end |