dns_adapter 0.0.8 → 0.0.9

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: bb25bfecdff375e7d6abe98038656a500af985a4
4
- data.tar.gz: 67e87217294a27c5710313ec79c08ffb4d8914cf
3
+ metadata.gz: 37bcf5f3488528421bd7ac3de6d0479a4818dd9a
4
+ data.tar.gz: 9e583c792d6f9206e63c2c8a62adeb91b7220d83
5
5
  SHA512:
6
- metadata.gz: 92c01fbc730c1239eb1bcf6a64f5c3185d77b15d9311a7d146c808bc59e95eda13cf04be8ae3a4b770f33427a9583cdbbba845a17907877090f5756ff402b9d0
7
- data.tar.gz: e80b36bb31ff0e7d7e694baf630938f678e85fc075b2f7f5daa27c97de21b19a7ae6eecde3147755a56d549364700c5726bcd416a4b17be6505264d7f19821ff
6
+ metadata.gz: 96faa0ba6d4a2deeceb98f41162bf8cb85ea29772cc60127b89e1ca4041f4a07ea8f39fb88f2afa9c3bdd45697be8a1d97c8dc8378c01091f9882e2abab84077
7
+ data.tar.gz: c046f472d3bbe2ac86ffe1bbf5eeefeab794215412cfd95e8ae10a492c4a69f74ae00b80c1654a64271fb0e76de2e2403c1d3e7d8c4661798bdbf5dd00960dc5
data/.codeclimate.yml CHANGED
@@ -1,9 +1,28 @@
1
1
  ---
2
2
  engines:
3
+ bundler-audit:
4
+ enabled: true
3
5
  duplication:
4
6
  enabled: true
7
+ exclude_paths:
8
+ - config/
9
+ - spec/
5
10
  config:
6
11
  languages:
7
12
  - ruby
8
13
  - javascript
9
-
14
+ fixme:
15
+ enabled: true
16
+ rubocop:
17
+ enabled: true
18
+ ratings:
19
+ paths:
20
+ - Gemfile.lock
21
+ - "**.erb"
22
+ - "**.haml"
23
+ - "**.rb"
24
+ - "**.coffee"
25
+ - "**.js"
26
+ - "**.jsx"
27
+ exclude_paths:
28
+ - coverage/
@@ -47,16 +47,27 @@ module DNSAdapter
47
47
  end
48
48
 
49
49
  def fetch_records(domain, type)
50
- record_set = find_records_for_domain(domain)
51
- return [] if record_set.empty?
52
- records = records_for_type(record_set, type)
50
+ records = raw_records(domain, type)
53
51
  if records.empty?
54
- check_for_timeout(record_set)
52
+ check_for_timeout(domain)
55
53
  else
56
54
  formatted_records(records, type)
57
55
  end
58
56
  end
59
57
 
58
+ def raw_records(domain, type)
59
+ record_set = find_records_for_domain(domain)
60
+ return [] if record_set.empty?
61
+ follow_cname(record_set, type) || records_for_type(record_set, type)
62
+ end
63
+
64
+ def follow_cname(record_set, type)
65
+ return nil if type == 'CNAME' # Never follow CNAME for a CNAME query
66
+ cname_record = formatted_records(records_for_type(record_set, 'CNAME'), 'CNAME').first
67
+ cname_target = cname_record.try(:[], :name)
68
+ cname_target.present? ? raw_records(cname_target, type) : nil
69
+ end
70
+
60
71
  private
61
72
 
62
73
  def normalize_domain(domain)
@@ -77,7 +88,8 @@ module DNSAdapter
77
88
  end
78
89
 
79
90
  TIMEOUT = 'TIMEOUT'.freeze
80
- def check_for_timeout(record_set)
91
+ def check_for_timeout(domain)
92
+ record_set = find_records_for_domain(domain)
81
93
  return [] if record_set.select { |r| r == TIMEOUT }.empty?
82
94
  raise DNSAdapter::TimeoutError
83
95
  end
@@ -1,3 +1,3 @@
1
1
  module DNSAdapter
2
- VERSION = '0.0.8'.freeze
2
+ VERSION = '0.0.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dns_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter M. Goldstein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-07 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler