github-pages-health-check 0.5.3 → 0.6.0
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/config/cloudflare-ips.txt +1 -1
- data/lib/github-pages-health-check.rb +18 -9
- data/lib/github-pages-health-check/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc104a3e85a562941afc89753b65de400d5a6246
|
4
|
+
data.tar.gz: 10fb769dbd57e8b8278844f868aa4971d40d01eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32a30fe370423c66e54c3562c0be938ccd9f619c6dc3103cfa3d03a757ee70514db57fef3a4e0ae43f484a30031adfeee334336d5cfaf1ba1cf029abc7b68a23
|
7
|
+
data.tar.gz: 071289ad2331dfaf1aaf2e52a96dbf6fe15083e97b5ffc6c27f1b49a3d05213c6e11831a7c765366a22cdce0af5d0f97ea6cc243220b66aac7ebd7833902a642
|
data/config/cloudflare-ips.txt
CHANGED
@@ -5,8 +5,9 @@ require "ipaddr"
|
|
5
5
|
require "public_suffix"
|
6
6
|
require "singleton"
|
7
7
|
require "net/http"
|
8
|
-
require
|
9
|
-
require
|
8
|
+
require "typhoeus"
|
9
|
+
require "resolv"
|
10
|
+
require "timeout"
|
10
11
|
require_relative "github-pages-health-check/version"
|
11
12
|
require_relative "github-pages-health-check/cloudflare"
|
12
13
|
require_relative "github-pages-health-check/error"
|
@@ -114,11 +115,15 @@ class GitHubPages
|
|
114
115
|
PublicSuffix.valid? domain
|
115
116
|
end
|
116
117
|
|
117
|
-
# Is this domain an
|
118
|
+
# Is this domain an apex domain, meaning a CNAME would be innapropriate
|
118
119
|
def apex_domain?
|
119
|
-
|
120
|
-
|
121
|
-
|
120
|
+
return @apex_domain if defined?(@apex_domain)
|
121
|
+
|
122
|
+
answers = Resolv::DNS.open { |dns|
|
123
|
+
dns.getresources(absolute_domain, Resolv::DNS::Resource::IN::NS)
|
124
|
+
}
|
125
|
+
|
126
|
+
@apex_domain = answers.any?
|
122
127
|
end
|
123
128
|
|
124
129
|
# Should the domain be an apex record?
|
@@ -171,7 +176,8 @@ class GitHubPages
|
|
171
176
|
alias_method :to_h, :to_hash
|
172
177
|
|
173
178
|
def served_by_pages?
|
174
|
-
if @served_by_pages
|
179
|
+
return @served_by_pages if defined? @served_by_pages
|
180
|
+
@served_by_pages = begin
|
175
181
|
response = Typhoeus.head(uri, TYPHOEUS_OPTIONS)
|
176
182
|
# Workaround for webmock not playing nicely with Typhoeus redirects
|
177
183
|
# See https://github.com/bblimke/webmock/issues/237
|
@@ -179,9 +185,12 @@ class GitHubPages
|
|
179
185
|
response = Typhoeus.head(response.headers["Location"], TYPHOEUS_OPTIONS)
|
180
186
|
end
|
181
187
|
|
182
|
-
|
188
|
+
return false unless response.mock? || response.return_code == :ok
|
189
|
+
return true if response.headers["Server"] == "GitHub.com"
|
190
|
+
|
191
|
+
# Typhoeus mangles the case of the header, compare insensitively
|
192
|
+
response.headers.any? { |k,v| k =~ /X-GitHub-Request-Id/i }
|
183
193
|
end
|
184
|
-
@served_by_pages
|
185
194
|
end
|
186
195
|
|
187
196
|
def to_json
|
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: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-dns
|
@@ -159,8 +159,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
161
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.
|
162
|
+
rubygems_version: 2.5.1
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: Checks your GitHub Pages site for commons DNS configuration issues
|
166
166
|
test_files: []
|
167
|
+
has_rdoc:
|