2014-07-24 21:31:57 +04:00
|
|
|
# GitHub Pages Health Check
|
2014-07-24 21:56:54 +04:00
|
|
|
|
2014-10-27 18:46:13 +03:00
|
|
|
*Checks your GitHub Pages site for common DNS configuration issues*
|
2014-07-24 21:56:54 +04:00
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
`gem install github-pages-health-check`
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Basic Usage
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
> check = GitHubPages::HealthCheck.new("choosealicense.com")
|
|
|
|
=> #<GitHubPages::HealthCheck @domain="choosealicense.com" valid?=true>
|
|
|
|
> check.valid?
|
|
|
|
=> true
|
|
|
|
```
|
|
|
|
|
|
|
|
### An invalid domain
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
> check = GitHubPages::HealthCheck.new("foo.github.com")
|
|
|
|
> check.valid?
|
|
|
|
=> false
|
|
|
|
> check.valid!
|
|
|
|
=> GitHubPages::HealthCheck::InvalidCNAME
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Retrieving specific checks
|
|
|
|
|
|
|
|
``` ruby
|
|
|
|
> check.should_be_a_record?
|
|
|
|
=> true
|
|
|
|
> check.a_record?
|
|
|
|
=> true
|
|
|
|
```
|
|
|
|
|
|
|
|
### Getting checks in bulk
|
|
|
|
|
2014-08-28 18:55:40 +04:00
|
|
|
```ruby
|
2014-07-24 21:56:54 +04:00
|
|
|
> check.to_hash
|
|
|
|
=> {
|
|
|
|
:cloudflare_ip?=>false,
|
|
|
|
:old_ip_address?=>false,
|
|
|
|
:a_record?=>true,
|
|
|
|
:cname_record?=>false,
|
|
|
|
:valid_domain?=>true,
|
|
|
|
:apex_domain?=>true,
|
|
|
|
:should_be_a_record?=>true,
|
|
|
|
:pointed_to_github_user_domain?=>false,
|
|
|
|
:pages_domain?=>false,
|
|
|
|
:valid?=>true
|
|
|
|
}
|
|
|
|
> require 'json'
|
|
|
|
> check.to_json
|
|
|
|
=> "{\"cloudflare_ip?\":false,\"old_ip_address?\":false,\"a_record?\":true,\"cname_record?\":false,\"valid_domain?\":true,\"apex_domain?\":true,\"should_be_a_record?\":true,\"pointed_to_github_user_domain?\":false,\"pages_domain?\":false,\"valid?\":true}"
|
|
|
|
```
|
2014-08-28 18:55:40 +04:00
|
|
|
|
|
|
|
### Getting the reason a domain is invalid
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
> check = GitHubPages::HealthCheck.new "developer.facebook.com"
|
|
|
|
> check.valid?
|
|
|
|
=> false
|
|
|
|
> check.reason
|
|
|
|
=> #<GitHubPages::HealthCheck::InvalidCNAME>
|
|
|
|
> check.reason.message
|
|
|
|
=> "CNAME does not point to GitHub Pages"
|
|
|
|
```
|