diff options
| author | David Broder-Rodgers | 2017-01-24 23:11:50 +0000 |
|---|---|---|
| committer | David Broder-Rodgers | 2017-02-20 19:24:35 +0000 |
| commit | a699d284d038907f884bb48f928f2e75ebadfc11 (patch) | |
| tree | 53d668acdc8cf7774d8fda016f57c124fa55ca7a /Library/Homebrew | |
| parent | 81b3368c9cba0f9db93af5732d8f10e75d00cdf9 (diff) | |
| download | brew-a699d284d038907f884bb48f928f2e75ebadfc11.tar.bz2 | |
Use DownloadStrategyDetector to classify mirror URLs
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index c685dacae..a7c9de576 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -1490,16 +1490,18 @@ class ResourceAuditor return unless @online urls.each do |url| - if url.start_with?("git") || url.end_with?(".git") - unless Utils.git_remote_exists url - problem "The URL #{url} is not a valid git URL" - end - elsif url.start_with? "http", "ftp" + strategy = DownloadStrategyDetector.detect(url) + if strategy <= CurlDownloadStrategy + problem url status_code = FormulaAuditor.url_status_code url unless status_code.start_with? "2" problem "The URL #{url} is not reachable (HTTP status code #{status_code})" end - elsif url.start_with? "svn" + elsif strategy <= GitDownloadStrategy + unless Utils.git_remote_exists url + problem "The URL #{url} is not a valid git URL" + end + elsif strategy <= SubversionDownloadStrategy unless Utils.svn_remote_exists url problem "The URL #{url} is not a valid svn URL" end |
