Class: Jekyll::RemoteTheme::Downloader
- Inherits:
-
Object
- Object
- Jekyll::RemoteTheme::Downloader
- Includes:
- Executor
- Defined in:
- lib/jekyll-remote-theme/downloader.rb
Constant Summary collapse
- HOST =
"https://codeload.github.com".freeze
- PROJECT_URL =
"https://github.com/benbalter/jekyll-remote-theme".freeze
- TYPHOEUS_OPTIONS =
{ :headers => { :user_agent => "Jekyll Remote Theme/#{VERSION} (+#{PROJECT_URL})", }, :verbose => (Jekyll.logger.level == :verbose), }.freeze
Constants included from Executor
Executor::TIMEOUT, Executor::TIMEOUT_COMMANDS
Instance Method Summary collapse
- #downloaded? ⇒ Boolean
-
#initialize(theme) ⇒ Downloader
constructor
A new instance of Downloader.
- #run ⇒ Object
Methods included from Executor
#run_command, #timeout_command
Constructor Details
#initialize(theme) ⇒ Downloader
Returns a new instance of Downloader.
20 21 22 |
# File 'lib/jekyll-remote-theme/downloader.rb', line 20 def initialize(theme) @theme = theme end |
Instance Method Details
#downloaded? ⇒ Boolean
36 37 38 |
# File 'lib/jekyll-remote-theme/downloader.rb', line 36 def downloaded? @downloaded ||= theme_dir_exists? && !theme_dir_empty? end |
#run ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/jekyll-remote-theme/downloader.rb', line 24 def run if downloaded? Jekyll.logger.debug LOG_KEY, "Using existing #{theme.name_with_owner}" return end download unzip @downloaded = true end |