You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cu...@apache.org on 2019/05/10 12:11:34 UTC
[whimsy] 01/03: Ensure output is sorted for later use
This is an automated email from the ASF dual-hosted git repository.
curcuru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
commit 60a0c61308c2c537e8a8c10b11adbeee9bb5dfb2
Author: Shane Curcuru <as...@shanecurcuru.org>
AuthorDate: Thu May 9 16:45:19 2019 -0400
Ensure output is sorted for later use
---
tools/mboxhdr2csv.rb | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/mboxhdr2csv.rb b/tools/mboxhdr2csv.rb
index 5675e35..358d963 100644
--- a/tools/mboxhdr2csv.rb
+++ b/tools/mboxhdr2csv.rb
@@ -257,7 +257,7 @@ end
# Side effect: writes out f.chomp(ext).json files
# @note writes string VERSION for differentiating from other *.json
def scan_dir_mbox2stats(dir, ext = MBOX_EXT)
- Dir["#{dir}/**/*#{ext}".untaint].each do |f|
+ Dir["#{dir}/**/*#{ext}".untaint].sort.each do |f|
mails, errs = mbox2stats(f.untaint)
File.open("#{f.chomp(ext)}.json", "w") do |fout|
fout.puts JSON.pretty_generate(["#{VERSION}", mails, errs])
@@ -269,11 +269,10 @@ end
# @return [ error1, error2, ...] if any errors
# Side effect: writes out dir/outname CSV file
# @note reads string VERSION for differentiating from other *.json
-def scan_dir_stats2csv(dir, outname)
+def scan_dir_stats2csv(dir, outname, ext = '.json')
errors = []
- filenames = Dir["#{dir}/**/*.json".untaint]
jzons = []
- filenames.each do |f|
+ Dir["#{dir}/**/*#{ext}".untaint].sort.each do |f|
begin
tmp = JSON.parse(File.read(f))
if tmp[0].kind_of?(String) && tmp[0].start_with?(VERSION)