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 +4 -4
- data/.codeclimate.yml +20 -1
- data/lib/dns_adapter/mock_client.rb +17 -5
- data/lib/dns_adapter/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: 37bcf5f3488528421bd7ac3de6d0479a4818dd9a
|
4
|
+
data.tar.gz: 9e583c792d6f9206e63c2c8a62adeb91b7220d83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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(
|
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(
|
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
|
data/lib/dns_adapter/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|