Module: GitHubPages::HealthCheck

Defined in:
lib/github-pages-health-check.rb,
lib/github-pages-health-check/caa.rb,
lib/github-pages-health-check/cdn.rb,
lib/github-pages-health-check/site.rb,
lib/github-pages-health-check/error.rb,
lib/github-pages-health-check/domain.rb,
lib/github-pages-health-check/errors.rb,
lib/github-pages-health-check/printer.rb,
lib/github-pages-health-check/version.rb,
lib/github-pages-health-check/resolver.rb,
lib/github-pages-health-check/checkable.rb,
lib/github-pages-health-check/repository.rb,
lib/github-pages-health-check/cdns/fastly.rb,
lib/github-pages-health-check/cdns/cloudflare.rb,
lib/github-pages-health-check/redundant_check.rb,
lib/github-pages-health-check/errors/build_error.rb,
lib/github-pages-health-check/errors/invalid_dns_error.rb,
lib/github-pages-health-check/errors/deprecated_ip_error.rb,
lib/github-pages-health-check/errors/invalid_cname_error.rb,
lib/github-pages-health-check/errors/invalid_domain_error.rb,
lib/github-pages-health-check/errors/invalid_a_record_error.rb,
lib/github-pages-health-check/errors/invalid_repository_error.rb,
lib/github-pages-health-check/errors/invalid_aaaa_record_error.rb,
lib/github-pages-health-check/errors/not_served_by_pages_error.rb,
lib/github-pages-health-check/errors/missing_access_token_error.rb

Defined Under Namespace

Modules: Errors Classes: CAA, CDN, Checkable, CloudFlare, Domain, Error, Fastly, Printer, RedundantCheck, Repository, Resolver, Site

Constant Summary collapse

TIMEOUT =

DNS and HTTP timeout, in seconds

7
HUMAN_NAME =
"GitHub Pages Health Check"
URL =
"https://github.com/github/pages-health-check"
USER_AGENT =
"Mozilla/5.0 (compatible; #{HUMAN_NAME}/#{VERSION}; +#{URL})"
VERSION =
"1.18.5"

Class Method Summary collapse

Class Method Details

.check(repository_or_domain, access_token: nil) ⇒ Object



53
54
55
# File 'lib/github-pages-health-check.rb', line 53

def self.check(repository_or_domain, access_token: nil)
  Site.new repository_or_domain, :access_token => access_token
end

.set_proxy(proxy_url) ⇒ Object

rubocop:disable Naming/AccessorMethodName (this is not an accessor method)



58
59
60
61
# File 'lib/github-pages-health-check.rb', line 58

def self.set_proxy(proxy_url)
  @typhoeus_options = typhoeus_options.merge(:proxy => proxy_url).freeze
  nil
end

.typhoeus_optionsObject

rubocop:enable Naming/AccessorMethodName



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/github-pages-health-check.rb', line 64

def self.typhoeus_options
  return @typhoeus_options if defined?(@typhoeus_options)

  @typhoeus_options = {
    :followlocation => true,
    :redir_protocols => %i[http https], # don't allow non-http protocols on redirections
    :timeout => TIMEOUT,
    :accept_encoding => "gzip",
    :method => :head,
    :headers => {
      "User-Agent" => USER_AGENT
    },
    :proxy => nil
  }.freeze
end

.without_warnings(&block) ⇒ Object

suppress warn-level feedback due to unsupported record types



45
46
47
48
49
50
51
# File 'lib/github-pages-health-check.rb', line 45

def self.without_warnings(&block)
  warn_level = $VERBOSE
  $VERBOSE = nil
  result = block.call
  $VERBOSE = warn_level
  result
end