Commit ff549fa3 authored by Colin Shea's avatar Colin Shea

dnsgit now works with --enable-frozen-string-literal

Though simplecov doesn't work :(
parent ed57027e
......@@ -104,7 +104,7 @@ class Zone
def srv(*args)
options = extract_options! args
name = "." << args.shift if args[0].is_a?(String)
name = ".#{args.shift}" if args[0].is_a?(String)
raise ArgumentError, "wrong number of arguments" unless (4..5).include?(args.count)
......@@ -142,7 +142,7 @@ class Zone
def tlsa(*args)
ttl = extract_ttl! args
name = args.shift if String===args[0]
name = (name=="@" || !name) ? '' : "." << name
name = (name=="@" || !name) ? '' : ".#{name}"
port = args.shift
protocol = args.shift
usage = args.shift
......
......@@ -424,93 +424,93 @@ class Zonefile
)
ENDH
out << "\n; Zone NS Records\n" unless self.ns.empty?
out += "\n; Zone NS Records\n" unless self.ns.empty?
self.ns.each do |ns|
out << "#{ns[:name]} #{ns[:ttl]} #{ns[:class]} NS #{ns[:host]}\n"
out += "#{ns[:name]} #{ns[:ttl]} #{ns[:class]} NS #{ns[:host]}\n"
end
out << "\n; Zone MX Records\n" unless self.mx.empty?
out += "\n; Zone MX Records\n" unless self.mx.empty?
self.mx.each do |mx|
out << "#{mx[:name]} #{mx[:ttl]} #{mx[:class]} MX #{mx[:pri]} #{mx[:host]}\n"
out += "#{mx[:name]} #{mx[:ttl]} #{mx[:class]} MX #{mx[:pri]} #{mx[:host]}\n"
end
out << "\n; Zone A Records\n" unless self.a.empty?
out += "\n; Zone A Records\n" unless self.a.empty?
self.a.each do |a|
out << "#{a[:name]} #{a[:ttl]} #{a[:class]} A #{a[:host]}\n"
out += "#{a[:name]} #{a[:ttl]} #{a[:class]} A #{a[:host]}\n"
end
out << "\n; Zone CNAME Records\n" unless self.cname.empty?
out += "\n; Zone CNAME Records\n" unless self.cname.empty?
self.cname.each do |cn|
out << "#{cn[:name]} #{cn[:ttl]} #{cn[:class]} CNAME #{cn[:host]}\n"
out += "#{cn[:name]} #{cn[:ttl]} #{cn[:class]} CNAME #{cn[:host]}\n"
end
out << "\n; Zone AAAA Records\n" unless self.aaaa.empty?
out += "\n; Zone AAAA Records\n" unless self.aaaa.empty?
self.aaaa.each do |aaaa|
out << "#{aaaa[:name]} #{aaaa[:ttl]} #{aaaa[:class]} AAAA #{aaaa[:host]}\n"
out += "#{aaaa[:name]} #{aaaa[:ttl]} #{aaaa[:class]} AAAA #{aaaa[:host]}\n"
end
out << "\n; Zone TXT Records\n" unless self.txt.empty?
out += "\n; Zone TXT Records\n" unless self.txt.empty?
self.txt.each do |tx|
out << "#{tx[:name]} #{tx[:ttl]} #{tx[:class]} TXT #{tx[:text]}\n"
out += "#{tx[:name]} #{tx[:ttl]} #{tx[:class]} TXT #{tx[:text]}\n"
end
out << "\n; Zone SPF Records\n" unless self.spf.empty?
out += "\n; Zone SPF Records\n" unless self.spf.empty?
self.spf.each do |spf|
out << "#{spf[:name]} #{spf[:ttl]} #{spf[:class]} SPF #{spf[:text]}\n"
out += "#{spf[:name]} #{spf[:ttl]} #{spf[:class]} SPF #{spf[:text]}\n"
end
out << "\n; Zone SRV Records\n" unless self.srv.empty?
out += "\n; Zone SRV Records\n" unless self.srv.empty?
self.srv.each do |srv|
out << "#{srv[:name]} #{srv[:ttl]} #{srv[:class]} SRV #{srv[:pri]} #{srv[:weight]} #{srv[:port]} #{srv[:host]}\n"
out += "#{srv[:name]} #{srv[:ttl]} #{srv[:class]} SRV #{srv[:pri]} #{srv[:weight]} #{srv[:port]} #{srv[:host]}\n"
end
out << "\n; Zone PTR Records\n" unless self.ptr.empty?
out += "\n; Zone PTR Records\n" unless self.ptr.empty?
self.ptr.each do |ptr|
out << "#{ptr[:name]} #{ptr[:ttl]} #{ptr[:class]} PTR #{ptr[:host]}\n"
out += "#{ptr[:name]} #{ptr[:ttl]} #{ptr[:class]} PTR #{ptr[:host]}\n"
end
out << "\n; Zone DS Records\n" unless self.ds.empty?
out += "\n; Zone DS Records\n" unless self.ds.empty?
self.ds.each do |ds|
out << "#{ds[:name]} #{ds[:ttl]} #{ds[:class]} DS #{ds[:key_tag]} #{ds[:algorithm]} #{ds[:digest_type]} #{ds[:digest]}\n"
out += "#{ds[:name]} #{ds[:ttl]} #{ds[:class]} DS #{ds[:key_tag]} #{ds[:algorithm]} #{ds[:digest_type]} #{ds[:digest]}\n"
end
out << "\n; Zone NSEC Records\n" unless self.ds.empty?
out += "\n; Zone NSEC Records\n" unless self.ds.empty?
self.nsec.each do |nsec|
out << "#{nsec[:name]} #{nsec[:ttl]} #{nsec[:class]} NSEC #{nsec[:next]} #{nsec[:types]}\n"
out += "#{nsec[:name]} #{nsec[:ttl]} #{nsec[:class]} NSEC #{nsec[:next]} #{nsec[:types]}\n"
end
out << "\n; Zone NSEC3 Records\n" unless self.ds.empty?
out += "\n; Zone NSEC3 Records\n" unless self.ds.empty?
self.nsec3.each do |nsec3|
out << "#{nsec3[:name]} #{nsec3[:ttl]} #{nsec3[:class]} NSEC3 #{nsec3[:algorithm]} #{nsec3[:flags]} #{nsec3[:iterations]} #{nsec3[:salt]} #{nsec3[:next]} #{nsec3[:types]}\n"
out += "#{nsec3[:name]} #{nsec3[:ttl]} #{nsec3[:class]} NSEC3 #{nsec3[:algorithm]} #{nsec3[:flags]} #{nsec3[:iterations]} #{nsec3[:salt]} #{nsec3[:next]} #{nsec3[:types]}\n"
end
out << "\n; Zone NSEC3PARAM Records\n" unless self.ds.empty?
out += "\n; Zone NSEC3PARAM Records\n" unless self.ds.empty?
self.nsec3param.each do |nsec3param|
out << "#{nsec3param[:name]} #{nsec3param[:ttl]} #{nsec3param[:class]} NSEC3PARAM #{nsec3param[:algorithm]} #{nsec3param[:flags]} #{nsec3param[:iterations]} #{nsec3param[:salt]}\n"
out += "#{nsec3param[:name]} #{nsec3param[:ttl]} #{nsec3param[:class]} NSEC3PARAM #{nsec3param[:algorithm]} #{nsec3param[:flags]} #{nsec3param[:iterations]} #{nsec3param[:salt]}\n"
end
out << "\n; Zone DNSKEY Records\n" unless self.ds.empty?
out += "\n; Zone DNSKEY Records\n" unless self.ds.empty?
self.dnskey.each do |dnskey|
out << "#{dnskey[:name]} #{dnskey[:ttl]} #{dnskey[:class]} DNSKEY #{dnskey[:flag]} #{dnskey[:protocol]} #{dnskey[:algorithm]} #{dnskey[:public_key]}\n"
out += "#{dnskey[:name]} #{dnskey[:ttl]} #{dnskey[:class]} DNSKEY #{dnskey[:flag]} #{dnskey[:protocol]} #{dnskey[:algorithm]} #{dnskey[:public_key]}\n"
end
out << "\n; Zone RRSIG Records\n" unless self.ds.empty?
out += "\n; Zone RRSIG Records\n" unless self.ds.empty?
self.rrsig.each do |rrsig|
out << "#{rrsig[:name]} #{rrsig[:ttl]} #{rrsig[:class]} RRSIG #{rrsig[:type_covered]} #{rrsig[:algorithm]} #{rrsig[:labels]} #{rrsig[:original_ttl]} #{rrsig[:expiration]} #{rrsig[:inception]} #{rrsig[:key_tag]} #{rrsig[:signer]} #{rrsig[:signature]}\n"
out += "#{rrsig[:name]} #{rrsig[:ttl]} #{rrsig[:class]} RRSIG #{rrsig[:type_covered]} #{rrsig[:algorithm]} #{rrsig[:labels]} #{rrsig[:original_ttl]} #{rrsig[:expiration]} #{rrsig[:inception]} #{rrsig[:key_tag]} #{rrsig[:signer]} #{rrsig[:signature]}\n"
end
out << "\n; Zone TLSA Records\n" unless self.tlsa.empty?
out += "\n; Zone TLSA Records\n" unless self.tlsa.empty?
self.tlsa.each do |tlsa|
out << "#{tlsa[:name]} #{tlsa[:ttl]} #{tlsa[:class]} TLSA #{tlsa[:certificate_usage]} #{tlsa[:selector]} #{tlsa[:matching_type]} #{tlsa[:data]}\n"
out += "#{tlsa[:name]} #{tlsa[:ttl]} #{tlsa[:class]} TLSA #{tlsa[:certificate_usage]} #{tlsa[:selector]} #{tlsa[:matching_type]} #{tlsa[:data]}\n"
end
out << "\n; Zone NAPTR Records\n" unless self.ds.empty?
out += "\n; Zone NAPTR Records\n" unless self.ds.empty?
self.naptr.each do |naptr|
out << "#{naptr[:name]} #{naptr[:ttl]} #{naptr[:class]} NAPTR #{naptr[:order]} #{naptr[:preference]} #{naptr[:flags]} #{naptr[:service]} #{naptr[:regexp]} #{naptr[:replacement]}\n"
out += "#{naptr[:name]} #{naptr[:ttl]} #{naptr[:class]} NAPTR #{naptr[:order]} #{naptr[:preference]} #{naptr[:flags]} #{naptr[:service]} #{naptr[:regexp]} #{naptr[:replacement]}\n"
end
out << "\n; Zone SSHFP Records\n" unless self.sshfp.empty?
out += "\n; Zone SSHFP Records\n" unless self.sshfp.empty?
self.sshfp.each do |sshfp|
out << "#{sshfp[:name]} #{sshfp[:ttl]} #{sshfp[:class]} SSHFP #{sshfp[:key_type]} #{sshfp[:fingerprint_type]} #{sshfp[:fingerprint]}\n"
out += "#{sshfp[:name]} #{sshfp[:ttl]} #{sshfp[:class]} SSHFP #{sshfp[:key_type]} #{sshfp[:fingerprint_type]} #{sshfp[:fingerprint]}\n"
end
out
......
......@@ -4,9 +4,17 @@ require 'yaml'
require 'minitest/autorun'
require 'minitest/pride'
require 'simplecov'
SimpleCov.start do
add_filter "tests/"
begin
if "".frozen?
puts "String literals are frozen, which SimpleCov is incompatibile with. No code coverage."
else
require 'simplecov'
SimpleCov.start do
add_filter "tests/"
end
end
rescue LoadError
puts "simplecov gem not installed. No code coverage."
end
$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment