github-pages-health-check 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/github-pages-health-check/domain.rb +6 -6
- data/lib/github-pages-health-check/error.rb +42 -0
- data/lib/github-pages-health-check/errors/build_error.rb +2 -0
- data/lib/github-pages-health-check/errors/deprecated_ip_error.rb +6 -1
- data/lib/github-pages-health-check/errors/invalid_a_record_error.rb +8 -1
- data/lib/github-pages-health-check/errors/invalid_cname_error.rb +8 -1
- data/lib/github-pages-health-check/errors/invalid_dns_error.rb +3 -0
- data/lib/github-pages-health-check/errors/invalid_domain_error.rb +2 -0
- data/lib/github-pages-health-check/errors/invalid_repository_error.rb +1 -0
- data/lib/github-pages-health-check/errors/missing_access_token_error.rb +1 -0
- data/lib/github-pages-health-check/errors/not_served_by_pages_error.rb +2 -0
- data/lib/github-pages-health-check/repository.rb +1 -1
- data/lib/github-pages-health-check/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac5d338582ae0432d783ad6e2ce77e87d1954c16
|
4
|
+
data.tar.gz: c91280a688eab7f1bfc1f916546edfb43171a436
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bf0a5e6b95798219f6d89553e6fd2ff01219242fe8a89f12476fa234289737f664fd1d0b599f099c071aa6c692d186db7884d7bd12acc5dd52925151c8e4ba4
|
7
|
+
data.tar.gz: 4af63470b8f55dcaf48126cdac6543cd9f1a88d2c38c9f8c571116184fbf508d5ed4ce29877a6b39d608b05a9f8bd0c33c4ebea7556057a73d702d897c23931e
|
@@ -34,13 +34,13 @@ module GitHubPages
|
|
34
34
|
|
35
35
|
# Runs all checks, raises an error if invalid
|
36
36
|
def check!
|
37
|
-
raise Errors::InvalidDomainError unless valid_domain?
|
38
|
-
raise Errors::InvalidDNSError unless dns_resolves?
|
37
|
+
raise Errors::InvalidDomainError.new(domain: self) unless valid_domain?
|
38
|
+
raise Errors::InvalidDNSError.new(domain: self) unless dns_resolves?
|
39
39
|
return true if proxied?
|
40
|
-
raise Errors::DeprecatedIPError if deprecated_ip?
|
41
|
-
raise Errors::InvalidARecordError if invalid_a_record?
|
42
|
-
raise Errors::InvalidCNAMEError if invalid_cname?
|
43
|
-
raise Errors::NotServedByPagesError unless served_by_pages?
|
40
|
+
raise Errors::DeprecatedIPError.new(domain: self) if deprecated_ip?
|
41
|
+
raise Errors::InvalidARecordError.new(domain: self) if invalid_a_record?
|
42
|
+
raise Errors::InvalidCNAMEError.new(domain: self) if invalid_cname?
|
43
|
+
raise Errors::NotServedByPagesError.new(domain: self) unless served_by_pages?
|
44
44
|
true
|
45
45
|
end
|
46
46
|
|
@@ -1,6 +1,18 @@
|
|
1
1
|
module GitHubPages
|
2
2
|
module HealthCheck
|
3
3
|
class Error < StandardError
|
4
|
+
DOCUMENTATION_BASE = "https://help.github.com"
|
5
|
+
DOCUMENTATION_PATH = "/categories/github-pages-basics/"
|
6
|
+
LOCAL_ONLY = false # Error is only used when running locally
|
7
|
+
|
8
|
+
attr_reader :repository, :domain
|
9
|
+
|
10
|
+
def initialize(repository: nil, domain: nil)
|
11
|
+
super
|
12
|
+
@repository = repository
|
13
|
+
@domain = domain
|
14
|
+
end
|
15
|
+
|
4
16
|
def self.inherited(base)
|
5
17
|
subclasses << base
|
6
18
|
end
|
@@ -8,6 +20,36 @@ module GitHubPages
|
|
8
20
|
def self.subclasses
|
9
21
|
@subclasses ||= []
|
10
22
|
end
|
23
|
+
|
24
|
+
def message
|
25
|
+
"Something's wrong with your GitHub Pages site."
|
26
|
+
end
|
27
|
+
|
28
|
+
# Error message, with get more info URL appended
|
29
|
+
def message_with_url
|
30
|
+
msg = message.gsub(/\s+/, " ").squeeze(" ").strip
|
31
|
+
msg << "." unless msg =~ /\.$/ #add trailing period if not there
|
32
|
+
"#{msg} #{more_info}"
|
33
|
+
end
|
34
|
+
alias_method :message_formatted, :message_with_url
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def username
|
39
|
+
if repository.nil?
|
40
|
+
"[YOUR USERNAME]"
|
41
|
+
else
|
42
|
+
repository.owner
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def more_info
|
47
|
+
"For more information, see #{documentation_url}."
|
48
|
+
end
|
49
|
+
|
50
|
+
def documentation_url
|
51
|
+
URI.join(Error::DOCUMENTATION_BASE, self.class::DOCUMENTATION_PATH).to_s
|
52
|
+
end
|
11
53
|
end
|
12
54
|
end
|
13
55
|
end
|
@@ -2,8 +2,13 @@ module GitHubPages
|
|
2
2
|
module HealthCheck
|
3
3
|
module Errors
|
4
4
|
class DeprecatedIPError < GitHubPages::HealthCheck::Error
|
5
|
+
DOCUMENTATION_PATH = "/articles/setting-up-a-custom-domain-with-github-pages/".freeze
|
6
|
+
|
5
7
|
def message
|
6
|
-
|
8
|
+
<<-MSG
|
9
|
+
The custom domain for your GitHub Pages site is pointed at an outdated IP address.
|
10
|
+
You must update your site's DNS records if you'd like it to be available via your custom domain.
|
11
|
+
MSG
|
7
12
|
end
|
8
13
|
end
|
9
14
|
end
|
@@ -2,8 +2,15 @@ module GitHubPages
|
|
2
2
|
module HealthCheck
|
3
3
|
module Errors
|
4
4
|
class InvalidARecordError < GitHubPages::HealthCheck::Error
|
5
|
+
# rubocop:disable Metrics/LineLength
|
6
|
+
DOCUMENTATION_PATH = "/articles/setting-up-a-custom-domain-with-github-pages/".freeze
|
7
|
+
|
5
8
|
def message
|
6
|
-
|
9
|
+
<<-MSG
|
10
|
+
Your site's DNS settings are using a custom subdomain, #{domain.host},
|
11
|
+
that's set up as an A record. We recommend you change this to a CNAME
|
12
|
+
record pointing at #{username}.github.io.
|
13
|
+
MSG
|
7
14
|
end
|
8
15
|
end
|
9
16
|
end
|
@@ -2,8 +2,15 @@ module GitHubPages
|
|
2
2
|
module HealthCheck
|
3
3
|
module Errors
|
4
4
|
class InvalidCNAMEError < GitHubPages::HealthCheck::Error
|
5
|
+
# rubocop:disable Metrics/LineLength
|
6
|
+
DOCUMENTATION_PATH = "/articles/setting-up-a-custom-domain-with-github-pages/".freeze
|
7
|
+
|
5
8
|
def message
|
6
|
-
|
9
|
+
<<-MSG
|
10
|
+
Your site's DNS settings are using a custom subdomain, #{domain.host},
|
11
|
+
that's not set up with a correct CNAME record. We recommend you set this
|
12
|
+
CNAME record to point at #{username}.github.io.
|
13
|
+
MSG
|
7
14
|
end
|
8
15
|
end
|
9
16
|
end
|
@@ -2,6 +2,9 @@ module GitHubPages
|
|
2
2
|
module HealthCheck
|
3
3
|
module Errors
|
4
4
|
class InvalidDNSError < GitHubPages::HealthCheck::Error
|
5
|
+
# rubocop:disable Metrics/LineLength
|
6
|
+
DOCUMENTATION_PATH = "/articles/setting-up-a-custom-domain-with-github-pages/".freeze
|
7
|
+
|
5
8
|
def message
|
6
9
|
"Domain's DNS record could not be retrieved"
|
7
10
|
end
|
@@ -2,6 +2,8 @@ module GitHubPages
|
|
2
2
|
module HealthCheck
|
3
3
|
module Errors
|
4
4
|
class NotServedByPagesError < GitHubPages::HealthCheck::Error
|
5
|
+
DOCUMENTATION_PATH = "/articles/setting-up-a-custom-domain-with-github-pages/".freeze
|
6
|
+
|
5
7
|
def message
|
6
8
|
"Domain does not resolve to the GitHub Pages server"
|
7
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-pages-health-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-dns
|
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
212
|
version: '0'
|
213
213
|
requirements: []
|
214
214
|
rubyforge_project:
|
215
|
-
rubygems_version: 2.6.
|
215
|
+
rubygems_version: 2.6.2
|
216
216
|
signing_key:
|
217
217
|
specification_version: 4
|
218
218
|
summary: Checks your GitHub Pages site for commons DNS configuration issues
|