net-dns 0.8.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +6 -14
  2. data/.rspec +1 -0
  3. data/.travis.yml +9 -16
  4. data/CHANGELOG.md +37 -13
  5. data/LICENSE.txt +56 -0
  6. data/README.md +94 -77
  7. data/demo/check_soa.rb +27 -38
  8. data/demo/threads.rb +3 -7
  9. data/lib/net/dns/header.rb +86 -110
  10. data/lib/net/dns/names.rb +31 -31
  11. data/lib/net/dns/packet.rb +148 -158
  12. data/lib/net/dns/question.rb +41 -42
  13. data/lib/net/dns/resolver/socks.rb +47 -55
  14. data/lib/net/dns/resolver/timeouts.rb +19 -30
  15. data/lib/net/dns/resolver.rb +151 -176
  16. data/lib/net/dns/rr/a.rb +45 -55
  17. data/lib/net/dns/rr/aaaa.rb +39 -50
  18. data/lib/net/dns/rr/classes.rb +32 -37
  19. data/lib/net/dns/rr/cname.rb +31 -41
  20. data/lib/net/dns/rr/hinfo.rb +40 -56
  21. data/lib/net/dns/rr/mr.rb +31 -42
  22. data/lib/net/dns/rr/mx.rb +35 -47
  23. data/lib/net/dns/rr/ns.rb +31 -41
  24. data/lib/net/dns/rr/null.rb +10 -15
  25. data/lib/net/dns/rr/ptr.rb +16 -24
  26. data/lib/net/dns/rr/soa.rb +36 -35
  27. data/lib/net/dns/rr/srv.rb +18 -19
  28. data/lib/net/dns/rr/txt.rb +11 -16
  29. data/lib/net/dns/rr/types.rb +118 -109
  30. data/lib/net/dns/rr.rb +107 -117
  31. data/lib/net/dns/version.rb +5 -13
  32. data/lib/net/dns.rb +6 -11
  33. metadata +18 -83
  34. data/.gitignore +0 -8
  35. data/Gemfile +0 -4
  36. data/Rakefile +0 -71
  37. data/fixtures/resolv.conf +0 -4
  38. data/lib/net/dns/core_ext.rb +0 -52
  39. data/net-dns.gemspec +0 -35
  40. data/test/header_test.rb +0 -167
  41. data/test/names_test.rb +0 -21
  42. data/test/packet_test.rb +0 -49
  43. data/test/question_test.rb +0 -83
  44. data/test/resolver/timeouts_test.rb +0 -109
  45. data/test/resolver_test.rb +0 -117
  46. data/test/rr/a_test.rb +0 -113
  47. data/test/rr/aaaa_test.rb +0 -109
  48. data/test/rr/classes_test.rb +0 -85
  49. data/test/rr/cname_test.rb +0 -97
  50. data/test/rr/hinfo_test.rb +0 -117
  51. data/test/rr/mr_test.rb +0 -105
  52. data/test/rr/mx_test.rb +0 -112
  53. data/test/rr/ns_test.rb +0 -86
  54. data/test/rr/types_test.rb +0 -69
  55. data/test/rr_test.rb +0 -131
  56. data/test/test_helper.rb +0 -4
data/lib/net/dns/rr.rb CHANGED
@@ -1,15 +1,14 @@
1
1
  require 'ipaddr'
2
- require 'net/dns/names'
3
- require 'net/dns/rr/types'
4
- require 'net/dns/rr/classes'
2
+ require_relative 'names'
3
+ require_relative 'rr/types'
4
+ require_relative 'rr/classes'
5
5
 
6
- %w(a aaaa cname hinfo mr mx ns ptr soa srv txt).each do |file|
7
- require "net/dns/rr/#{file}"
6
+ %w[a aaaa cname hinfo mr mx ns ptr soa srv txt].each do |file|
7
+ require_relative "rr/#{file}"
8
8
  end
9
9
 
10
10
  module Net
11
11
  module DNS
12
-
13
12
  #
14
13
  # = Net::DNS::RR - DNS Resource Record class
15
14
  #
@@ -42,7 +41,6 @@ module Net
42
41
  class RR
43
42
  include Names
44
43
 
45
-
46
44
  # Base error class.
47
45
  class Error < StandardError
48
46
  end
@@ -51,7 +49,6 @@ module Net
51
49
  class DataError < Error
52
50
  end
53
51
 
54
-
55
52
  # Regexp matching an RR string
56
53
  RR_REGEXP = Regexp.new("^\\s*(\\S+)\\s*(\\d+)?\\s+(" +
57
54
  Net::DNS::RR::Classes.regexp +
@@ -63,7 +60,6 @@ module Net
63
60
  # RR portion of the packet, in bytes
64
61
  RRFIXEDSZ = 10
65
62
 
66
-
67
63
  # Create a new instance of Net::DNS::RR class, or an instance of
68
64
  # any of the subclass of the appropriate type.
69
65
  #
@@ -108,12 +104,12 @@ module Net
108
104
  #
109
105
  def initialize(arg)
110
106
  instance = case arg
111
- when String
112
- new_from_string(arg)
113
- when Hash
114
- new_from_hash(arg)
115
- else
116
- raise ArgumentError, "Invalid argument, must be a RR string or an hash of values"
107
+ when String
108
+ new_from_string(arg)
109
+ when Hash
110
+ new_from_hash(arg)
111
+ else
112
+ raise ArgumentError, "Invalid argument, must be a RR string or an hash of values"
117
113
  end
118
114
 
119
115
  if @type.to_s == "ANY"
@@ -133,7 +129,7 @@ module Net
133
129
  # This method is used when parsing a binary packet by the Packet
134
130
  # class.
135
131
  #
136
- def RR.parse(data)
132
+ def self.parse(data)
137
133
  o = allocate
138
134
  obj, offset = o.send(:new_from_binary, data, 0)
139
135
  obj
@@ -146,18 +142,14 @@ module Net
146
142
  # Return an instance of appropriate class and the offset
147
143
  # pointing at the end of the data parsed.
148
144
  #
149
- def RR.parse_packet(data, offset)
145
+ def self.parse_packet(data, offset)
150
146
  o = allocate
151
147
  o.send(:new_from_binary, data, offset)
152
148
  end
153
149
 
154
- def name
155
- @name
156
- end
150
+ attr_reader :name
157
151
 
158
- def ttl
159
- @ttl
160
- end
152
+ attr_reader :ttl
161
153
 
162
154
  # Type accessor
163
155
  def type
@@ -169,16 +161,13 @@ module Net
169
161
  @cls.to_s
170
162
  end
171
163
 
172
-
173
164
  def value
174
165
  get_inspect
175
166
  end
176
167
 
177
168
  # Data belonging to that appropriate class,
178
169
  # not to be used (use real accessors instead)
179
- def rdata
180
- @rdata
181
- end
170
+ attr_reader :rdata
182
171
 
183
172
  # Return the RR object in binary data format, suitable
184
173
  # for using in network streams.
@@ -201,14 +190,13 @@ module Net
201
190
  #
202
191
  # TO FIX in one of the future releases
203
192
  #
204
- def comp_data(offset,compnames)
193
+ def comp_data(offset, compnames)
205
194
  str, offset, names = dn_comp(@name, offset, compnames)
206
195
  str += [@type.to_i, @cls.to_i, ttl, @rdlength].pack("n2 N n")
207
196
  offset += Net::DNS::RRFIXEDSZ
208
197
  [str, offset, names]
209
198
  end
210
199
 
211
-
212
200
  # Returns a human readable representation of this record.
213
201
  # The value is always a String.
214
202
  #
@@ -226,7 +214,7 @@ module Net
226
214
  # #=> "example.com. 7200 IN MX 10 mailhost.example.com."
227
215
  #
228
216
  def to_s
229
- items = to_a.map { |e| e.to_s }
217
+ items = to_a.map(&:to_s)
230
218
  if @name.size < 24
231
219
  items.pack("A24 A8 A8 A8 A*")
232
220
  else
@@ -244,123 +232,125 @@ module Net
244
232
  [name, ttl, cls.to_s, type.to_s, value]
245
233
  end
246
234
 
247
-
248
235
  private
249
236
 
250
- def new_from_string(rrstring)
251
- unless rrstring =~ RR_REGEXP
252
- raise ArgumentError,
253
- "Format error for RR string (maybe CLASS and TYPE not valid?)"
254
- end
237
+ def new_from_string(rrstring)
238
+ unless rrstring =~ RR_REGEXP
239
+ raise ArgumentError,
240
+ "Format error for RR string (maybe CLASS and TYPE not valid?)"
241
+ end
255
242
 
256
- # Name of RR - mandatory
257
- begin
258
- @name = $1.downcase
259
- rescue NoMethodError
260
- raise ArgumentError, "Missing name field in RR string #{rrstring}"
261
- end
243
+ # Name of RR - mandatory
244
+ begin
245
+ @name = Regexp.last_match(1).downcase
246
+ rescue NoMethodError
247
+ raise ArgumentError, "Missing name field in RR string #{rrstring}"
248
+ end
262
249
 
263
- # Time to live for RR, default 3 hours
264
- @ttl = $2 ? $2.to_i : 10800
250
+ # Time to live for RR, default 3 hours
251
+ @ttl = Regexp.last_match(2) ? Regexp.last_match(2).to_i : 10_800
265
252
 
266
- # RR class, default to IN
267
- @cls = Net::DNS::RR::Classes.new $3
253
+ # RR class, default to IN
254
+ @cls = Net::DNS::RR::Classes.new Regexp.last_match(3)
268
255
 
269
- # RR type, default to A
270
- @type = Net::DNS::RR::Types.new $4
256
+ # RR type, default to A
257
+ @type = Net::DNS::RR::Types.new Regexp.last_match(4)
271
258
 
272
- # All the rest is data
273
- @rdata = $5 ? $5.strip : ""
259
+ # All the rest is data
260
+ @rdata = Regexp.last_match(5) ? Regexp.last_match(5).strip : ""
274
261
 
275
- if self.class == Net::DNS::RR
276
- Net::DNS::RR.const_get(@type.to_s).new(rrstring)
277
- else
278
- subclass_new_from_string(@rdata)
279
- self.class
280
- end
262
+ if self.class == Net::DNS::RR
263
+ Net::DNS::RR.const_get(@type.to_s).new(rrstring)
264
+ else
265
+ subclass_new_from_string(@rdata)
266
+ self.class
281
267
  end
268
+ end
282
269
 
283
- def new_from_hash(args)
284
- # Name field is mandatory
285
- unless args.has_key? :name
286
- raise ArgumentError, ":name field is mandatory"
287
- end
270
+ def new_from_hash(args)
271
+ # Name field is mandatory
272
+ unless args.key? :name
273
+ raise ArgumentError, ":name field is mandatory"
274
+ end
288
275
 
289
- @name = args[:name].downcase
290
- @ttl = args[:ttl] ? args[:ttl].to_i : 10800 # Default 3 hours
291
- @type = Net::DNS::RR::Types.new args[:type]
292
- @cls = Net::DNS::RR::Classes.new args[:cls]
276
+ @name = args[:name].downcase
277
+ @ttl = args[:ttl] ? args[:ttl].to_i : 10_800 # Default 3 hours
278
+ @type = Net::DNS::RR::Types.new args[:type]
279
+ @cls = Net::DNS::RR::Classes.new args[:cls]
293
280
 
294
- @rdata = args[:rdata] ? args[:rdata].strip : ""
295
- @rdlength = args[:rdlength] || @rdata.size
281
+ @rdata = args[:rdata] ? args[:rdata].strip : ""
282
+ @rdlength = args[:rdlength] || @rdata.size
296
283
 
297
- if self.class == Net::DNS::RR
298
- Net::DNS::RR.const_get(@type.to_s).new(args)
284
+ if self.class == Net::DNS::RR
285
+ Net::DNS::RR.const_get(@type.to_s).new(args)
286
+ else
287
+ hash = args.delete_if { |k, _| %i[name ttl type cls].include?(k) }
288
+ if hash.key? :rdata
289
+ subclass_new_from_string(hash[:rdata])
299
290
  else
300
- hash = args - [:name, :ttl, :type, :cls]
301
- if hash.has_key? :rdata
302
- subclass_new_from_string(hash[:rdata])
303
- else
304
- subclass_new_from_hash(hash)
305
- end
306
- self.class
291
+ subclass_new_from_hash(hash)
307
292
  end
293
+ self.class
308
294
  end
295
+ end
309
296
 
310
- def new_from_binary(data,offset)
311
- if self.class == Net::DNS::RR
312
- temp = dn_expand(data,offset)[1]
313
- type = Net::DNS::RR::Types.new data.unpack("@#{temp} n")[0]
314
- (eval "Net::DNS::RR::#{type}").parse_packet(data,offset)
315
- else
316
- @name,offset = dn_expand(data,offset)
317
- rrtype,cls,@ttl,@rdlength = data.unpack("@#{offset} n2 N n")
318
- @type = Net::DNS::RR::Types.new rrtype
319
- @cls = Net::DNS::RR::Classes.new cls
320
- offset += RRFIXEDSZ
321
- offset = subclass_new_from_binary(data,offset)
322
- build_pack
323
- set_type
324
- [self, offset]
325
- end
297
+ def new_from_binary(data, offset)
298
+ if self.class == Net::DNS::RR
299
+ temp = dn_expand(data, offset)[1]
300
+ type = Net::DNS::RR::Types.new data.unpack1("@#{temp} n")
301
+ (eval "Net::DNS::RR::#{type}").parse_packet(data, offset)
302
+ else
303
+ @name, offset = dn_expand(data, offset)
304
+ rrtype, cls, @ttl, @rdlength = data.unpack("@#{offset} n2 N n")
305
+ @type = Net::DNS::RR::Types.new rrtype
306
+ @cls = Net::DNS::RR::Classes.new cls
307
+ offset += RRFIXEDSZ
308
+ offset = subclass_new_from_binary(data, offset)
309
+ build_pack
310
+ set_type
311
+ [self, offset]
326
312
  end
313
+ end
327
314
 
328
- # Methods to be overridden by subclasses
329
- def subclass_new_from_array(arr)
330
- end
331
- def subclass_new_from_string(str)
332
- end
333
- def subclass_new_from_hash(hash)
334
- end
335
- def subclass_new_from_binary(data, offset)
336
- end
337
- def build_pack
338
- end
339
- def get_inspect
340
- @rdata
341
- end
342
- def get_data
343
- @rdata
344
- end
315
+ # Methods to be overridden by subclasses
316
+ def subclass_new_from_array(arr)
317
+ end
345
318
 
346
- def set_type
347
- # TODO: Here we should probably
348
- # raise NotImplementedError
349
- # if we want the method to be implemented in any subclass.
350
- end
319
+ def subclass_new_from_string(str)
320
+ end
351
321
 
322
+ def subclass_new_from_hash(hash)
323
+ end
324
+
325
+ def subclass_new_from_binary(data, offset)
326
+ end
327
+
328
+ def build_pack
329
+ end
330
+
331
+ def get_inspect
332
+ @rdata
333
+ end
334
+
335
+ def get_data
336
+ @rdata
337
+ end
338
+
339
+ def set_type
340
+ # TODO: Here we should probably
341
+ # raise NotImplementedError
342
+ # if we want the method to be implemented in any subclass.
343
+ end
352
344
 
353
345
  def self.new(*args)
354
346
  o = allocate
355
- obj = o.send(:initialize,*args)
347
+ obj = o.send(:initialize, *args)
356
348
  if self == Net::DNS::RR
357
349
  obj
358
350
  else
359
351
  o
360
352
  end
361
353
  end
362
-
363
354
  end
364
-
365
355
  end
366
356
  end
@@ -1,16 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Net
2
4
  module DNS
3
- module Version
4
-
5
- MAJOR = 0
6
- MINOR = 8
7
- PATCH = 0
8
- BUILD = nil
9
-
10
- STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join(".")
11
- end
12
-
13
- VERSION = Version::STRING
14
-
5
+ # The current library version.
6
+ VERSION = "0.20.0"
15
7
  end
16
- end
8
+ end
data/lib/net/dns.rb CHANGED
@@ -1,10 +1,9 @@
1
- require 'net/dns/core_ext'
2
- require 'net/dns/version'
3
- require 'net/dns/resolver'
1
+ require_relative 'dns/version'
2
+ require_relative 'dns/resolver'
3
+ require_relative 'dns/rr'
4
4
 
5
5
  module Net
6
6
  module DNS
7
-
8
7
  # Packet size in bytes
9
8
  PACKETSZ = 512
10
9
 
@@ -23,9 +22,7 @@ module Net
23
22
  # Size of a short int
24
23
  INT16SZ = 2
25
24
 
26
-
27
25
  module QueryTypes
28
-
29
26
  SIGZERO = 0
30
27
  A = 1
31
28
  NS = 2
@@ -71,6 +68,7 @@ module Net
71
68
  RRSIG = 46
72
69
  NSEC = 47
73
70
  DNSKEY = 48
71
+ SPF = 99
74
72
  UINFO = 100
75
73
  UID = 101
76
74
  GID = 102
@@ -82,11 +80,11 @@ module Net
82
80
  MAILB = 253
83
81
  MAILA = 254
84
82
  ANY = 255
85
-
83
+ URI = 256
84
+ CAA = 257
86
85
  end
87
86
 
88
87
  module QueryClasses
89
-
90
88
  # Internet class
91
89
  IN = 1
92
90
 
@@ -101,12 +99,9 @@ module Net
101
99
 
102
100
  # Any class
103
101
  ANY = 255
104
-
105
102
  end
106
103
 
107
104
  include QueryTypes
108
105
  include QueryClasses
109
-
110
106
  end
111
-
112
107
  end
metadata CHANGED
@@ -1,44 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Ceresa
8
8
  - Simone Carletti
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-08 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rake
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ~>
19
- - !ruby/object:Gem::Version
20
- version: '10.0'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ~>
26
- - !ruby/object:Gem::Version
27
- version: '10.0'
28
- - !ruby/object:Gem::Dependency
29
- name: yard
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ! '>='
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ! '>='
40
- - !ruby/object:Gem::Version
41
- version: '0'
12
+ date: 2023-12-18 00:00:00.000000000 Z
13
+ dependencies: []
42
14
  description: Net::DNS is a pure Ruby DNS library, with a clean OO interface and an
43
15
  extensible API.
44
16
  email:
@@ -46,20 +18,18 @@ email:
46
18
  - weppos@weppos.net
47
19
  executables: []
48
20
  extensions: []
49
- extra_rdoc_files: []
21
+ extra_rdoc_files:
22
+ - LICENSE.txt
50
23
  files:
51
- - .gitignore
52
- - .travis.yml
24
+ - ".rspec"
25
+ - ".travis.yml"
53
26
  - CHANGELOG.md
54
- - Gemfile
27
+ - LICENSE.txt
55
28
  - README.md
56
- - Rakefile
57
29
  - THANKS.rdoc
58
30
  - demo/check_soa.rb
59
31
  - demo/threads.rb
60
- - fixtures/resolv.conf
61
32
  - lib/net/dns.rb
62
- - lib/net/dns/core_ext.rb
63
33
  - lib/net/dns/header.rb
64
34
  - lib/net/dns/names.rb
65
35
  - lib/net/dns/packet.rb
@@ -83,62 +53,27 @@ files:
83
53
  - lib/net/dns/rr/txt.rb
84
54
  - lib/net/dns/rr/types.rb
85
55
  - lib/net/dns/version.rb
86
- - net-dns.gemspec
87
- - test/header_test.rb
88
- - test/names_test.rb
89
- - test/packet_test.rb
90
- - test/question_test.rb
91
- - test/resolver/timeouts_test.rb
92
- - test/resolver_test.rb
93
- - test/rr/a_test.rb
94
- - test/rr/aaaa_test.rb
95
- - test/rr/classes_test.rb
96
- - test/rr/cname_test.rb
97
- - test/rr/hinfo_test.rb
98
- - test/rr/mr_test.rb
99
- - test/rr/mx_test.rb
100
- - test/rr/ns_test.rb
101
- - test/rr/types_test.rb
102
- - test/rr_test.rb
103
- - test/test_helper.rb
104
56
  homepage: http://github.com/bluemonk/net-dns
105
- licenses: []
57
+ licenses:
58
+ - Ruby
106
59
  metadata: {}
107
- post_install_message:
60
+ post_install_message:
108
61
  rdoc_options: []
109
62
  require_paths:
110
63
  - lib
111
64
  required_ruby_version: !ruby/object:Gem::Requirement
112
65
  requirements:
113
- - - ! '>='
66
+ - - ">="
114
67
  - !ruby/object:Gem::Version
115
- version: 1.8.7
68
+ version: '2.6'
116
69
  required_rubygems_version: !ruby/object:Gem::Requirement
117
70
  requirements:
118
- - - ! '>='
71
+ - - ">="
119
72
  - !ruby/object:Gem::Version
120
73
  version: '0'
121
74
  requirements: []
122
- rubyforge_project: net-dns
123
- rubygems_version: 2.0.3
124
- signing_key:
75
+ rubygems_version: 3.4.21
76
+ signing_key:
125
77
  specification_version: 4
126
78
  summary: Pure Ruby DNS library.
127
- test_files:
128
- - test/header_test.rb
129
- - test/names_test.rb
130
- - test/packet_test.rb
131
- - test/question_test.rb
132
- - test/resolver/timeouts_test.rb
133
- - test/resolver_test.rb
134
- - test/rr/a_test.rb
135
- - test/rr/aaaa_test.rb
136
- - test/rr/classes_test.rb
137
- - test/rr/cname_test.rb
138
- - test/rr/hinfo_test.rb
139
- - test/rr/mr_test.rb
140
- - test/rr/mx_test.rb
141
- - test/rr/ns_test.rb
142
- - test/rr/types_test.rb
143
- - test/rr_test.rb
144
- - test/test_helper.rb
79
+ test_files: []
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- # Bundler
2
- .bundle
3
- pkg/*
4
- Gemfile.lock
5
-
6
- # YARD artifacts
7
- .yardoc
8
- yardoc/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in whois.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,71 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
-
4
- $:.unshift(File.dirname(__FILE__) + "/lib")
5
- require 'net/dns'
6
-
7
-
8
- # Common package properties
9
- PKG_NAME = ENV['PKG_NAME'] || 'net-dns'
10
- PKG_VERSION = ENV['PKG_VERSION'] || Net::DNS::VERSION
11
-
12
-
13
- # Run test by default.
14
- task :default => :test
15
-
16
-
17
- spec = Gem::Specification.new do |s|
18
- s.name = PKG_NAME
19
- s.version = PKG_VERSION
20
- s.summary = "Pure Ruby DNS library."
21
- s.description = "Net::DNS is a pure Ruby DNS library, with a clean OO interface and an extensible API."
22
-
23
- s.required_ruby_version = ">= 1.8.7"
24
-
25
- s.authors = ["Marco Ceresa", "Simone Carletti"]
26
- s.email = ["ceresa@gmail.com", "weppos@weppos.net"]
27
- s.homepage = "http://github.com/bluemonk/net-dns"
28
- s.rubyforge_project = "net-dns"
29
-
30
- s.add_development_dependency "rake", "~> 10.0"
31
- s.add_development_dependency "yard"
32
-
33
- s.files = `git ls-files`.split("\n")
34
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
35
- s.require_paths = %w( lib )
36
- end
37
-
38
-
39
- require 'rubygems/package_task'
40
-
41
- Gem::PackageTask.new(spec) do |pkg|
42
- pkg.gem_spec = spec
43
- end
44
-
45
- desc "Build the gemspec file #{spec.name}.gemspec"
46
- task :gemspec do
47
- file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
48
- File.open(file, "w") {|f| f << spec.to_ruby }
49
- end
50
-
51
-
52
- require 'rake/testtask'
53
-
54
- # Run all the tests in the /test folder
55
- Rake::TestTask.new do |t|
56
- t.libs << "test"
57
- t.test_files = FileList["test/**/*_test.rb"]
58
- t.verbose = true
59
- end
60
-
61
-
62
- require 'yard'
63
- require 'yard/rake/yardoc_task'
64
-
65
- YARD::Rake::YardocTask.new(:yardoc)
66
-
67
-
68
- desc "Open an irb session preloaded with this library"
69
- task :console do
70
- sh "irb -rubygems -I lib -r net/dns.rb"
71
- end
data/fixtures/resolv.conf DELETED
@@ -1,4 +0,0 @@
1
- search corporate.thoughtworks.com
2
- nameserver 192.168.1.1
3
- nameserver 192.168.1.2
4
- nameserver 192.168.1.3 192.168.1.4