Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 48 lines (43 sloc) 1.738 kB
afb4065 @weppos Super simple and super buggy initial version. It works, but sometimes…
authored
1 namespace :server do
2
07cd39b @weppos Refactoring class to use an object oriented server definition. The li…
authored
3 desc "server:convert_file_tlds"
4 task :convert_file_tlds do
afb4065 @weppos Super simple and super buggy initial version. It works, but sometimes…
authored
5 servers = File.readlines("data/tld_serv_list").map do |line|
6 line.chomp!
7 line.gsub!(/^\s*(.*)\s*$/, '\1')
8 line.gsub!(/\s*#.*$/, '')
9 if line =~ /^([\w\d\.-]+)\s+([\w\d\.:-]+|[A-Z]+\s+.*)$/
07cd39b @weppos Refactoring class to use an object oriented server definition. The li…
authored
10 extension, instructions = $1, $2
11 server, options = case
12 when instructions == "NONE"
13 [nil, { :adapter => Whois::Server::Adapters::None }]
14 when instructions == "ARPA"
15 [nil, { :adapter => Whois::Server::Adapters::Arpa }]
16 when instructions =~ /^WEB (.*)$/
17 [nil, { :adapter => Whois::Server::Adapters::Web, :web => $1 }]
18 when instructions == "CRSNIC"
19 ["whois.crsnic.net", { :adapter => Whois::Server::Adapters::Verisign }]
20 when instructions == "PIR"
21 ["whois.publicinterestregistry.net", { :adapter => Whois::Server::Adapters::Pir }]
22 when instructions == "AFILIAS"
23 ["whois.afilias-grs.info", { :adapter => Whois::Server::Adapters::Afilias }]
24 when instructions == "NICCC"
25 ["whois.nic.cc", { :adapter => Whois::Server::Adapters::Verisign }]
26 else
27 [instructions]
28 end
29
30 <<-RUBY
31 Whois::Server.define #{extension.inspect}, \
32 #{server.inspect}\
33 #{options.nil? ? "" : ", " + options.inspect}
34 RUBY
afb4065 @weppos Super simple and super buggy initial version. It works, but sometimes…
authored
35 end
36 end.reject { |value| value == '' || value.nil? }
37
07cd39b @weppos Refactoring class to use an object oriented server definition. The li…
authored
38 File.open("lib/whois/definitions/tlds.rb", "w+") do |f|
39 f.write(<<-HEADER)
40 # WARNING: This file is autogenerated. Don't edit manually.
41
42 HEADER
43 f.write(servers)
44 end
afb4065 @weppos Super simple and super buggy initial version. It works, but sometimes…
authored
45 puts "Created file with #{servers.size} servers."
46 end
47
48 end
Something went wrong with that request. Please try again.