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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ae14ced41d6ce019b7d842dadd4eb7869c772f4
4
- data.tar.gz: a55009148b66e16360fa82fef97fb12151645b04
3
+ metadata.gz: ac5d338582ae0432d783ad6e2ce77e87d1954c16
4
+ data.tar.gz: c91280a688eab7f1bfc1f916546edfb43171a436
5
5
  SHA512:
6
- metadata.gz: 3f7294eea6132d79bb8b4894c841627af1bd7ab4f97a02dd24e8cb0b901ea564da11c338d7c017e2d7e73430e344510f82f6c9cee1253a5111704521c062b8ae
7
- data.tar.gz: 0b1208f94e784bf3f9acfab628b5e5886ddd4569fd50186516bf7e62c8f4dce8dc3353ec268e4a94d2be951d8abe9895a4e07b0ac146e439b5c783eb573002b0
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,6 +2,8 @@ module GitHubPages
2
2
  module HealthCheck
3
3
  module Errors
4
4
  class BuildError < GitHubPages::HealthCheck::Error
5
+ DOCUMENTATION_PATH = '/articles/troubleshooting-jekyll-builds/'
6
+ LOCAL_ONLY = true
5
7
  end
6
8
  end
7
9
  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
- "A record points to deprecated IP address"
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
- "Should not be an A record"
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
- "CNAME does not point to GitHub Pages"
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 InvalidDomainError < GitHubPages::HealthCheck::Error
5
+ DOCUMENTATION_PATH = "/articles/setting-up-a-custom-domain-with-github-pages/".freeze
6
+
5
7
  def message
6
8
  "Domain is not a valid domain"
7
9
  end
@@ -2,6 +2,7 @@ module GitHubPages
2
2
  module HealthCheck
3
3
  module Errors
4
4
  class InvalidRepositoryError < GitHubPages::HealthCheck::Error
5
+ LOCAL_ONLY = true
5
6
  def message
6
7
  "Repository is not a valid repository"
7
8
  end
@@ -2,6 +2,7 @@ module GitHubPages
2
2
  module HealthCheck
3
3
  module Errors
4
4
  class MissingAccessTokenError < GitHubPages::HealthCheck::Error
5
+ LOCAL_ONLY = true
5
6
  def message
6
7
  "Cannot retrieve repository information with a valid access token"
7
8
  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
@@ -26,7 +26,7 @@ module GitHubPages
26
26
  alias_method :nwo, :name_with_owner
27
27
 
28
28
  def check!
29
- raise Errors::BuildError, build_error unless built?
29
+ raise Errors::BuildError.new(repository: self), build_error unless built?
30
30
  true
31
31
  end
32
32
 
@@ -1,5 +1,5 @@
1
1
  module GitHubPages
2
2
  module HealthCheck
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  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.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-03-10 00:00:00.000000000 Z
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.1
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