Класс: GitHubArtifactDownloadStrategy Приватный
- Наследует:
- AbstractFileDownloadStrategy
- Object
- AbstractDownloadStrategy
- AbstractFileDownloadStrategy
- GitHubArtifactDownloadStrategy
- Определён в:
- utils/github/artifacts/github_artifact_download_strategy.rb
Обзор
Этот класс является частью закрытого API. Этот класс можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам не следует использовать этот класс, поскольку он может быть удалён или изменён без предупреждения.
Стратегия загрузки артефакта из GitHub Actions.
Краткое описание атрибутов экземпляра
Атрибуты, унаследованные от AbstractDownloadStrategy
Краткое описание методов экземпляра свернуть
- #fetch(timeout: nil) ⇒ void приватный
- #initialize(url, artifact_id, token:) ⇒ void конструктор приватный
Методы, унаследованные от AbstractFileDownloadStrategy
#basename, #cached_location, #create_symlink_to_cached_download, #fetched_size, #symlink_location, #temporary_path
Методы, унаследованные от AbstractDownloadStrategy
#basename, #cached_location, #clear_cache, #fetched_size, #ohai, #quiet!, #quiet?, #source_modified_time, #source_revision, #stage, #total_size
Методы, включённые из Utils::Output::Mixin
#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_upgradable, #pretty_warning
Методы, включённые из SystemCommand::Mixin
#system_command, #system_command!
Методы, включённые из Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Подробное описание конструкторов
#initialize(url, artifact_id, token:) ⇒ void
Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. Третьим лицам по возможности не следует использовать этот метод, поскольку он может быть удалён или изменён без предупреждения.
7 8 9 10 11 | # File 'utils/github/artifacts/github_artifact_download_strategy.rb', line 7 def initialize(url, artifact_id, token:) super(url, "artifact", artifact_id) @cache = T.let(HOMEBREW_CACHE/"gh-actions-artifact", Pathname) @token = token end |
Подробное описание методов экземпляра
#fetch(timeout: nil) ⇒ void
Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. Третьим лицам по возможности не следует использовать этот метод, поскольку он может быть удалён или изменён без предупреждения.
Этот метод возвращает неопределённое значение.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # File 'utils/github/artifacts/github_artifact_download_strategy.rb', line 14 def fetch(timeout: nil) ohai "Downloading #{url}" if cached_location.exist? puts "Already downloaded: #{cached_location}" else begin Utils::Curl.curl_download(url, to: temporary_path, header: "Authorization: token #{@token}", secrets: [@token], timeout:) rescue ErrorDuringExecution raise CurlDownloadStrategyError, url end cached_location.dirname.mkpath temporary_path.rename(cached_location.to_s) end symlink_location.dirname.mkpath FileUtils.ln_s cached_location.relative_path_from(symlink_location.dirname), symlink_location, force: true end |
© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/GitHubArtifactDownloadStrategy.html