Use DownloadStrategyDetector to classify mirror URLs
This commit is contained in:
parent
81b3368c9c
commit
a699d284d0
@ -1490,16 +1490,18 @@ class ResourceAuditor
|
|||||||
|
|
||||||
return unless @online
|
return unless @online
|
||||||
urls.each do |url|
|
urls.each do |url|
|
||||||
if url.start_with?("git") || url.end_with?(".git")
|
strategy = DownloadStrategyDetector.detect(url)
|
||||||
unless Utils.git_remote_exists url
|
if strategy <= CurlDownloadStrategy
|
||||||
problem "The URL #{url} is not a valid git URL"
|
problem url
|
||||||
end
|
|
||||||
elsif url.start_with? "http", "ftp"
|
|
||||||
status_code = FormulaAuditor.url_status_code url
|
status_code = FormulaAuditor.url_status_code url
|
||||||
unless status_code.start_with? "2"
|
unless status_code.start_with? "2"
|
||||||
problem "The URL #{url} is not reachable (HTTP status code #{status_code})"
|
problem "The URL #{url} is not reachable (HTTP status code #{status_code})"
|
||||||
end
|
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
|
unless Utils.svn_remote_exists url
|
||||||
problem "The URL #{url} is not a valid svn URL"
|
problem "The URL #{url} is not a valid svn URL"
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user