github-pages-health-check 1.7.3 → 1.7.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb41e9f55a6bba28f9fa077b54b9a52bae3bf5f4
4
- data.tar.gz: bb1148932d9a479162202e5fec212307469b2f0a
3
+ metadata.gz: 03a16a95ebcc2d31fe9f0de07cc2a00018d8a604
4
+ data.tar.gz: 4358dbd798f76a759a8876daf4d7811f14b6c135
5
5
  SHA512:
6
- metadata.gz: adbf9c16daa505c35b2bd8caf45689f1c28dded8524a65d65d5b9af9e380bc0ca60a49ae3c29559c5695dcdbdec2a4c209829e03680927753c65de94d506179f
7
- data.tar.gz: ec9b09bca3faf4027edb5aa8a66a8bd4e05a4180ec6d536f5079f47f1ae8a9bdf9db0c385c9f9fed1ab61f11040eb27ecdd5fec2b728715191b5892bc0423265
6
+ metadata.gz: 794287ba5221e2c5ea8506594167309b9a9de12c6b887206b5b4a575b3c42e9b3b86918e506624cf6da134a72510ceeebfb0125c8cabb0ee0b66ba88559008b9
7
+ data.tar.gz: fe84086c554d3faf80742e607086cbbcf7eeb04a114edb7871200dc860849e9549d44189948fa80c9d27df796da221d34279f2473861982e083390d97a3696c6
@@ -10,6 +10,8 @@ module GitHubPages
10
10
  attr_reader :error
11
11
 
12
12
  def initialize(host)
13
+ raise ArgumentError, "host cannot be nil" if host.nil?
14
+
13
15
  @host = host
14
16
  end
15
17
 
@@ -36,7 +38,12 @@ module GitHubPages
36
38
  private
37
39
 
38
40
  def get_caa_records(domain)
39
- query(domain).select { |r| r.type == "CAA" && r.property_tag == "issue" }
41
+ return [] if domain.nil?
42
+ query(domain).select { |r| issue_caa_record?(r) }
43
+ end
44
+
45
+ def issue_caa_record?(record)
46
+ record.type == Dnsruby::Types::CAA && record.property_tag == "issue"
40
47
  end
41
48
 
42
49
  def query(domain)
@@ -44,8 +51,8 @@ module GitHubPages
44
51
  resolver.retry_times = 2
45
52
  resolver.query_timeout = 2
46
53
  begin
47
- resolver.query(domain, "CAA", "IN").answer
48
- rescue StandardError => e
54
+ resolver.query(domain, Dnsruby::Types::CAA).answer
55
+ rescue Dnsruby::ResolvError => e
49
56
  @error = e
50
57
  []
51
58
  end
@@ -149,9 +149,9 @@ module GitHubPages
149
149
  PublicSuffix.domain(host) == host
150
150
  end
151
151
 
152
- # Should the domain be an apex record?
152
+ # Should the domain use an A record?
153
153
  def should_be_a_record?
154
- !pages_domain? && (apex_domain? || mx_records_present?)
154
+ !pages_io_domain? && (apex_domain? || mx_records_present?)
155
155
  end
156
156
 
157
157
  def should_be_cname_record?
@@ -187,6 +187,11 @@ module GitHubPages
187
187
  end
188
188
 
189
189
  # Is the host a *.github.io domain?
190
+ def pages_io_domain?
191
+ !!host.match(/\A[\w-]+\.github\.(io)\.?\z/i)
192
+ end
193
+
194
+ # Is the host a *.github.(io|com) domain?
190
195
  def pages_domain?
191
196
  !!host.match(/\A[\w-]+\.github\.(io|com)\.?\z/i)
192
197
  end
@@ -356,7 +361,7 @@ module GitHubPages
356
361
  private
357
362
 
358
363
  def caa
359
- @caa ||= GitHubPages::HealthCheck::CAA.new(absolute_domain)
364
+ @caa ||= GitHubPages::HealthCheck::CAA.new(host)
360
365
  end
361
366
 
362
367
  # The domain's response to HTTP(S) requests, following redirects
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitHubPages
4
4
  module HealthCheck
5
- VERSION = "1.7.3".freeze
5
+ VERSION = "1.7.4".freeze
6
6
  end
7
7
  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.7.3
4
+ version: 1.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-25 00:00:00.000000000 Z
11
+ date: 2018-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable