github-pages-health-check 0.5.2 → 0.5.3
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.rb +15 -8
- data/lib/github-pages-health-check/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ef63bec86a31b05e0155b7d329fe07db3a5f551
|
4
|
+
data.tar.gz: ffd1fc33ab713437823c8ed406a5128c7d2047e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33f9bd1b69e92f3b61e7f6757a06bce975691ba037f03560e6538eccf6b2517de0d500e8cb342a1125c85f980ff3441cf2ed0fc1c4cf77de6babf0f7b4985ebc
|
7
|
+
data.tar.gz: 614131b277cea29a033ab26e64293662746d4c9a67c7b7e9daf09a31632a80a04211e52cf37c15bbdfeeee8459886876f218c64e9d4f218a090900f47575b19e
|
@@ -70,13 +70,19 @@ class GitHubPages
|
|
70
70
|
|
71
71
|
# Returns an array of DNS answers
|
72
72
|
def dns
|
73
|
-
@dns
|
74
|
-
|
75
|
-
|
73
|
+
if @dns.nil?
|
74
|
+
begin
|
75
|
+
@dns = Timeout::timeout(TIMEOUT) do
|
76
|
+
without_warnings do
|
77
|
+
Net::DNS::Resolver.start(absolute_domain).answer if domain
|
78
|
+
end
|
79
|
+
end
|
80
|
+
@dns ||= false
|
81
|
+
rescue Exception
|
82
|
+
@dns = false
|
76
83
|
end
|
77
84
|
end
|
78
|
-
|
79
|
-
nil
|
85
|
+
@dns || nil
|
80
86
|
end
|
81
87
|
|
82
88
|
# Are we even able to get the DNS record?
|
@@ -103,7 +109,7 @@ class GitHubPages
|
|
103
109
|
end
|
104
110
|
|
105
111
|
# Is this a valid domain that PublicSuffix recognizes?
|
106
|
-
# Used as an escape hatch to prevent false
|
112
|
+
# Used as an escape hatch to prevent false positives on DNS checkes
|
107
113
|
def valid_domain?
|
108
114
|
PublicSuffix.valid? domain
|
109
115
|
end
|
@@ -165,7 +171,7 @@ class GitHubPages
|
|
165
171
|
alias_method :to_h, :to_hash
|
166
172
|
|
167
173
|
def served_by_pages?
|
168
|
-
@served_by_pages
|
174
|
+
if @served_by_pages.nil?
|
169
175
|
response = Typhoeus.head(uri, TYPHOEUS_OPTIONS)
|
170
176
|
# Workaround for webmock not playing nicely with Typhoeus redirects
|
171
177
|
# See https://github.com/bblimke/webmock/issues/237
|
@@ -173,8 +179,9 @@ class GitHubPages
|
|
173
179
|
response = Typhoeus.head(response.headers["Location"], TYPHOEUS_OPTIONS)
|
174
180
|
end
|
175
181
|
|
176
|
-
(response.mock? || response.return_code == :ok) && response.headers["Server"] == "GitHub.com"
|
182
|
+
@served_by_pages = (response.mock? || response.return_code == :ok) && response.headers["Server"] == "GitHub.com"
|
177
183
|
end
|
184
|
+
@served_by_pages
|
178
185
|
end
|
179
186
|
|
180
187
|
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.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-dns
|