Merge pull request #1693 from broder/homepage_check

Updated homepage 404 check to use explicit parameters and return the …
This commit is contained in:
Mike McQuaid 2016-12-23 19:14:08 +00:00 committed by GitHub
commit cd13e306a8
2 changed files with 6 additions and 7 deletions

View File

@ -569,11 +569,10 @@ class FormulaAuditor
end
return unless @online
begin
nostdout { curl "--connect-timeout", "15", "-o", "/dev/null", homepage }
rescue ErrorDuringExecution
problem "The homepage is not reachable (curl exit code #{$?.exitstatus})"
end
status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0",
"--write-out", "%{http_code}", homepage
return if status_code.start_with? "20"
problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})"
end
def audit_bottle_spec

View File

@ -429,8 +429,8 @@ class FormulaAuditorTests < Homebrew::TestCase
fa.audit_homepage
assert_equal ["The homepage should start with http or https " \
"(URL is #{fa.formula.homepage}).", "The homepage is not reachable " \
"(curl exit code #{$?.exitstatus})"], fa.problems
"(URL is #{fa.formula.homepage}).", "The homepage #{fa.formula.homepage} is not reachable " \
"(HTTP status code 000)"], fa.problems
formula_homepages = {
"bar" => "http://www.freedesktop.org/wiki/bar",