Class: GitHubArtifactDownloadStrategy
- Inherits:
-
AbstractFileDownloadStrategy
- Object
- AbstractDownloadStrategy
- AbstractFileDownloadStrategy
- GitHubArtifactDownloadStrategy
- Defined in:
- 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(timeout: nil) ⇒ Object
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 |
# File 'dev-cmd/pr-pull.rb', line 508 def fetch(timeout: nil) 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, []), timeout: timeout 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 |