Class: Aquatone::Detectors::GithubPages

Inherits:
Aquatone::Detector show all
Defined in:
lib/aquatone/detectors/github_pages.rb

Constant Summary collapse

APEX_VALUES =
%w(192.30.252.153 192.30.252.154).freeze
CNAME_VALUE =
".github.io".freeze
RESPONSE_FINGERPRINT =
"There isn't a GitHub Pages site here.".freeze

Instance Attribute Summary

Attributes inherited from Aquatone::Detector

#host, #resource

Instance Method Summary collapse

Methods inherited from Aquatone::Detector

descendants, #initialize, meta, meta=, #positive?, sluggified_name

Constructor Details

This class inherits a constructor from Aquatone::Detector

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
# File 'lib/aquatone/detectors/github_pages.rb', line 15

def run
  if apex_resource?
    return false unless APEX_VALUES.include?(resource_value)
  elsif cname_resource?
    return false unless resource_value.end_with?(CNAME_VALUE)
  end
  get_request("http://#{host}/").body.include?(RESPONSE_FINGERPRINT)
end