Class: GitHubArtifactDownloadStrategy

Inherits:
AbstractFileDownloadStrategy show all
Defined in:
brew/Library/Homebrew/dev-cmd/pr-pull.rb

Instance Attribute Summary

Attributes inherited from AbstractDownloadStrategy

#cache, #cached_location, #source_modified_time, #url

Instance Method Summary collapse

Methods inherited from AbstractFileDownloadStrategy

#basename, #cached_location, #symlink_location, #temporary_path

Methods inherited from AbstractDownloadStrategy

#basename, #clear_cache, #initialize, #ohai, #puts, #shutup!, #stage

Constructor Details

This class inherits a constructor from AbstractDownloadStrategy

Instance Method Details

#fetchObject



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'brew/Library/Homebrew/dev-cmd/pr-pull.rb', line 227

def fetch
  ohai "Downloading #{url}"
  if cached_location.exist?
    puts "Already downloaded: #{cached_location}"
  else
    begin
      curl "--location", "--create-dirs", "--output", temporary_path, url,
           *meta.fetch(:curl_args, []),
           secrets: meta.fetch(:secrets, [])
    rescue ErrorDuringExecution
      raise CurlDownloadStrategyError, url
    end
    ignore_interrupts do
      cached_location.dirname.mkpath
      temporary_path.rename(cached_location)
      symlink_location.dirname.mkpath
    end
  end
  FileUtils.ln_s cached_location.relative_path_from(symlink_location.dirname), symlink_location, force: true
end