Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a TLD subfolder when using mkwhois #3

Merged
merged 1 commit into from Dec 3, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion utils/mkwhois.rb
Expand Up @@ -13,9 +13,10 @@
n = ARGV.shift || raise("Missing file name")

r = Whois.lookup(d)
tld = r.server.allocation[1..-1]

r.parts.each do |part|
target = File.expand_path("../../spec/fixtures/responses/#{part.host}/#{n}.txt", __FILE__)
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}"
Expand Down