From 65b19485176e4cde850fb2120742fbcf412fcdb6 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Wed, 15 Mar 2017 17:19:34 -0400 Subject: [PATCH] Avoid interleaving status output with file listing. Before: [ Getting snapshot pages.. found 1 snaphots to consider. {"file_url":"http://www.trackpedia.com:80/forums/archive/index.php/f-115.html","timestamp":20131221124252,"file_id":"forums/archive/index.php/f-115.html"}, ] After: Getting snapshot pages.. found 1 snaphots to consider. [ {"file_url":"http://www.trackpedia.com:80/forums/archive/index.php/f-115.html","timestamp":20131221124252,"file_id":"forums/archive/index.php/f-115.html"}, ] --- lib/wayback_machine_downloader.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/wayback_machine_downloader.rb b/lib/wayback_machine_downloader.rb index bc71597..0e79623 100644 --- a/lib/wayback_machine_downloader.rb +++ b/lib/wayback_machine_downloader.rb @@ -135,8 +135,11 @@ class WaybackMachineDownloader end def list_files + # retrieval produces its own output + files = get_file_list_by_timestamp + # ... hence delay printing the opening bracket puts "[" - get_file_list_by_timestamp.each do |file| + files.each do |file| puts file.to_json + "," end puts "]"