Класс: DownloadStrategyDetector Частный
- Наследует:
- Object
- Object
- DownloadStrategyDetector
- Определён в:
- download_strategy/download_strategy_detector.rb
Обзор
Этот класс является частью закрытого API. Этот класс можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого класса, поскольку он может быть удалён или изменён без предупреждения.
Вспомогательный класс для определения стратегии загрузки по URL.
Краткое описание методов класса свернуть
- .detect(url, using = nil) ⇒ T::Class[AbstractDownloadStrategy] закрытый
- .detect_from_symbol(symbol) ⇒ T::Class[AbstractDownloadStrategy] закрытый
- .detect_from_url(url) ⇒ T::Class[AbstractDownloadStrategy] закрытый
Подробное описание методов класса
.detect(url, using = nil) ⇒ T::Class[AbstractDownloadStrategy]
Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.
10 11 12 13 14 15 16 17 18 19 20 21 | # File 'download_strategy/download_strategy_detector.rb', line 10 def self.detect(url, using = nil) if using.nil? detect_from_url(url) elsif using.is_a?(Class) && using < AbstractDownloadStrategy using elsif using.is_a?(Symbol) detect_from_symbol(using) else raise TypeError, "Unknown download strategy specification: #{using.inspect}" end end |
.detect_from_symbol(symbol) ⇒ T::Class[AbstractDownloadStrategy]
Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | # File 'download_strategy/download_strategy_detector.rb', line 64 def self.detect_from_symbol(symbol) case symbol when :hg then MercurialDownloadStrategy when :nounzip then NoUnzipCurlDownloadStrategy when :git then GitDownloadStrategy when :bzr then BazaarDownloadStrategy when :svn then SubversionDownloadStrategy when :curl then CurlDownloadStrategy when :homebrew_curl then HomebrewCurlDownloadStrategy when :cvs then CVSDownloadStrategy when :post then CurlPostDownloadStrategy when :fossil then FossilDownloadStrategy else raise TypeError, "Unknown download strategy #{symbol} was requested." end end |
.detect_from_url(url) ⇒ T::Class[AbstractDownloadStrategy]
Этот метод является частью закрытого API. Этот метод можно использовать только в репозитории Homebrew/brew. По возможности сторонним разработчикам следует избегать использования этого метода, поскольку он может быть удалён или изменён без предупреждения.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | # File 'download_strategy/download_strategy_detector.rb', line 24 def self.detect_from_url(url) case url when GitHubPackages::URL_REGEX CurlGitHubPackagesDownloadStrategy when %r{^https?://github\.com/[^/]+/[^/]+\.git$} GitHubGitDownloadStrategy when %r{^https?://.+\.git$}, %r{^git://}, %r{^https?://git\.sr\.ht/[^/]+/[^/]+$}, %r{^https?://tangled\.sh/[^/]+/[^/]+$}, %r{^ssh://git} GitDownloadStrategy when %r{^https?://www\.apache\.org/dyn/closer\.cgi}, %r{^https?://www\.apache\.org/dyn/closer\.lua} CurlApacheMirrorDownloadStrategy when %r{^https?://files\.pythonhosted\.org/packages/} PyPIDownloadStrategy when %r{^https?://([A-Za-z0-9\-.]+\.)?googlecode\.com/svn}, %r{^https?://svn\.}, %r{^svn://}, %r{^svn\+http://}, %r{^http://svn\.apache\.org/repos/}, %r{^https?://([A-Za-z0-9\-.]+\.)?sourceforge\.net/svnroot/} SubversionDownloadStrategy when %r{^cvs://} CVSDownloadStrategy when %r{^hg://}, %r{^https?://([A-Za-z0-9\-.]+\.)?googlecode\.com/hg}, %r{^https?://([A-Za-z0-9\-.]+\.)?sourceforge\.net/hgweb/} MercurialDownloadStrategy when %r{^bzr://} BazaarDownloadStrategy when %r{^fossil://} FossilDownloadStrategy else CurlDownloadStrategy end end |
© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/DownloadStrategyDetector.html