Sha256: 607956defdba0e14685dd6cf6856c58ba688a3091269de92465431d72acd77a1

Contents?: true

Size: 811 Bytes

Versions: 10

Compression:

Stored size: 811 Bytes

Contents

#!/usr/bin/env ruby -w

# Usage:
#
# $ ./utils/mkwhois.rb google.com.br status_registered
#
# It will execute the query and dump the result into a file
# called status_registered.txt into the appriate folder based
# on the hostname that was queried, and the TLD.

$:.unshift(File.expand_path("../../lib", __FILE__))

require 'fileutils'
require 'whois'
begin
  require File.expand_path("../whois-utf8", __FILE__)
rescue LoadError
end

d = ARGV.shift || raise("Missing domain")
n = ARGV.shift || raise("Missing file name")

r = Whois.lookup(d)
tld = r.server.allocation

r.parts.each do |part|
  target = File.expand_path("../../spec/fixtures/responses/#{part.host}/#{tld}/#{n}.txt", __FILE__)
  FileUtils.mkdir_p(File.dirname(target))
  File.open(target, "w+") { |f| f.write(part.body) }
  puts "#{target}"
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
whois-6.0.1 utils/mkwhois.rb
whois-6.0.0 utils/mkwhois.rb
whois-5.1.1 utils/mkwhois.rb
whois-parser-2.0.0 utils/mkwhois.rb
whois-5.1.0 utils/mkwhois.rb
whois-5.0.2 utils/mkwhois.rb
whois-5.0.1 utils/mkwhois.rb
whois-5.0.0 utils/mkwhois.rb
whois-parser-1.2.0 utils/mkwhois.rb
whois-4.1.0 utils/mkwhois.rb