Класс: GitHubGitDownloadStrategy
- Наследует:
- GitDownloadStrategy
- Object
- AbstractDownloadStrategy
- VCSDownloadStrategy
- GitDownloadStrategy
- GitHubGitDownloadStrategy
- Определён в:
- download_strategy/github_git_download_strategy.rb
Обзор
Стратегия загрузки репозитория Git с GitHub.
Краткое описание констант
Константы, унаследованные от GitDownloadStrategy
GitDownloadStrategy::MINIMUM_COMMIT_HASH_LENGTH
Константы, унаследованные от VCSDownloadStrategy
VCSDownloadStrategy::REF_TYPES
Краткое описание атрибутов экземпляра
Атрибуты, унаследованные от VCSDownloadStrategy
Атрибуты, унаследованные от AbstractDownloadStrategy
Краткое описание методов свернуть
- #commit_outdated?(commit) ⇒ Boolean приватный
- #default_branch ⇒ String? приватный
- #default_refspec ⇒ String приватный
- #initialize(url, name, version, **meta) ⇒ void конструктор приватный
- #last_commit ⇒ String приватный
Методы, унаследованные от GitDownloadStrategy
#source_modified_time, #source_revision
Методы, унаследованные от VCSDownloadStrategy
#fetch, #fetch_last_commit, #head?
Методы, унаследованные от AbstractDownloadStrategy
#basename, #cached_location, #clear_cache, #fetch, #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, name, version, **meta) ⇒ void
Этот метод является частью приватного API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.
9 10 11 12 13 14 15 16 17 18 | # File 'download_strategy/github_git_download_strategy.rb', line 9 def initialize(url, name, version, **) super @version = version match_data = %r{^https?://github\.com/(?<user>[^/]+)/(?<repo>[^/]+)\.git$}.match(@url) return unless match_data @user = T.let(match_data[:user], T.nilable(String)) @repo = T.let(match_data[:repo], T.nilable(String)) end |
Подробное описание методов экземпляра
#commit_outdated?(commit) ⇒ Boolean
Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.
28 29 30 31 32 33 34 35 36 37 38 39 | # File 'download_strategy/github_git_download_strategy.rb', line 28 def commit_outdated?(commit) return true unless commit return super if last_commit.blank? return true unless last_commit.start_with?(commit) if GitHub.multiple_short_commits_exist?(T.must(@user), T.must(@repo), commit) true else T.must(@version).update_commit(commit) false end end |
#default_branch ⇒ String?
Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.
51 52 53 54 55 56 57 58 59 60 61 62 63 | # File 'download_strategy/github_git_download_strategy.rb', line 51 def default_branch return @default_branch if defined?(@default_branch) command! "git", args: ["remote", "set-head", "origin", "--auto"], chdir: cached_location result = command! "git", args: ["symbolic-ref", "refs/remotes/origin/HEAD"], chdir: cached_location @default_branch = T.let(result.stdout[%r{^refs/remotes/origin/(.*)$}, 1], T.nilable(String)) end |
#default_refspec ⇒ String
Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.
42 43 44 45 46 47 48 | # File 'download_strategy/github_git_download_strategy.rb', line 42 def default_refspec if default_branch "+refs/heads/#{default_branch}:refs/remotes/origin/#{default_branch}" else super end end |
#last_commit ⇒ String
Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.
21 22 23 24 25 | # File 'download_strategy/github_git_download_strategy.rb', line 21 def last_commit @last_commit ||= GitHub.last_commit(T.must(@user), T.must(@repo), @ref, T.cast(T.must(version), Version), length: MINIMUM_COMMIT_HASH_LENGTH) @last_commit || super end |
© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/GitHubGitDownloadStrategy.html