github-pages-health-check 1.1.0 → 1.1.1

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: aa3d74adf88a4ef1a35fe97bb48a41c4ddf355c1
4
- data.tar.gz: 6087da3407bc4f842b86663f115d12aeff5b3e40
3
+ metadata.gz: 9ae14ced41d6ce019b7d842dadd4eb7869c772f4
4
+ data.tar.gz: a55009148b66e16360fa82fef97fb12151645b04
5
5
  SHA512:
6
- metadata.gz: 1a9290587e49058b6bf7b162b3bf64c0395255039c38484f02386fcb4d1476ee491d6f1554cc5e09ffce95997ecb3a045c4dd22708afef32b81768210b8c4df8
7
- data.tar.gz: e0804bdec43fd0a892d005df9bae2dcdea39e478ff2f26af215f0ed71c14f5f1f622b5e52469303a7952c4c6da5c0640f8538a0c705271faa25814547e97c583
6
+ metadata.gz: 3f7294eea6132d79bb8b4894c841627af1bd7ab4f97a02dd24e8cb0b901ea564da11c338d7c017e2d7e73430e344510f82f6c9cee1253a5111704521c062b8ae
7
+ data.tar.gz: 0b1208f94e784bf3f9acfab628b5e5886ddd4569fd50186516bf7e62c8f4dce8dc3353ec268e4a94d2be951d8abe9895a4e07b0ac146e439b5c783eb573002b0
@@ -29,7 +29,7 @@ module GitHubPages
29
29
  raise ArgumentError, "Expected string, got #{host.class}"
30
30
  end
31
31
 
32
- @host = host_from_uri(host)
32
+ @host = normalize_host(host)
33
33
  end
34
34
 
35
35
  # Runs all checks, raises an error if invalid
@@ -241,16 +241,20 @@ module GitHubPages
241
241
  #
242
242
  # Examples
243
243
  #
244
- # host_from_uri("benbalter.github.com")
244
+ # normalize_host("benbalter.github.com")
245
245
  # # => 'benbalter.github.com'
246
- # host_from_uri("https://benbalter.github.com")
246
+ # normalize_host("https://benbalter.github.com")
247
247
  # # => 'benbalter.github.com'
248
- # host_from_uri("benbalter.github.com/help-me-im-a-path/")
248
+ # normalize_host("benbalter.github.com/help-me-im-a-path/")
249
249
  # # => 'benbalter.github.com'
250
250
  #
251
251
  # Return the hostname.
252
- def host_from_uri(domain)
253
- Addressable::URI.parse(domain).host || Addressable::URI.parse("http://#{domain}").host
252
+ def normalize_host(domain)
253
+ domain = domain.strip.chomp(".")
254
+ host = Addressable::URI.parse(domain).host || Addressable::URI.parse("http://#{domain}").host
255
+ host unless host.to_s.empty?
256
+ rescue Addressable::URI::InvalidURIError
257
+ nil
254
258
  end
255
259
 
256
260
  # Adjust `domain` so that it won't be searched for with /etc/resolv.conf's search rules.
@@ -1,5 +1,5 @@
1
1
  module GitHubPages
2
2
  module HealthCheck
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
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.0
4
+ version: 1.1.1
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-03 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-dns