Class: GitHubArtifactDownloadStrategy
- Inherits:
-
AbstractFileDownloadStrategy
- Object
- AbstractDownloadStrategy
- AbstractFileDownloadStrategy
- GitHubArtifactDownloadStrategy
- Defined in:
- 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, #quiet?, #shutup!, #stage
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
This class inherits a constructor from AbstractDownloadStrategy
Instance Method Details
#fetch ⇒ Object
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
# File 'Library/Homebrew/dev-cmd/pr-pull.rb', line 417 def fetch ohai "Downloading #{url}" if cached_location.exist? puts "Already downloaded: #{cached_location}" else begin curl "--location", "--create-dirs", "--output", temporary_path, url, *.fetch(:curl_args, []), secrets: .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 |