This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 06047455 See how well the JSON diffs work
06047455 is described below

commit 06047455ebc44b4646937db945334783790d0992
Author: Sebb <[email protected]>
AuthorDate: Sun Feb 25 15:55:53 2024 +0000

    See how well the JSON diffs work
---
 www/roster/public_json_common.rb | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/www/roster/public_json_common.rb b/www/roster/public_json_common.rb
index 154241b1..464bab23 100644
--- a/www/roster/public_json_common.rb
+++ b/www/roster/public_json_common.rb
@@ -10,6 +10,8 @@
 $LOAD_PATH.unshift '/srv/whimsy/lib'
 require 'whimsy/asf'
 require 'json'
+require 'stringio'
+require 'whimsy/asf/json-utils'
 
 require 'open3'
 require 'wunderbar'
@@ -123,6 +125,15 @@ def write_output(file, results)
 
     if File.exist?(file)
       @changed = ChangeStatus::CHANGED
+      # Note: we reparse results rather than trying to use the original json
+      # to esure consistency with the file settings re: symbols etc
+      begin
+        jsonout = StringIO.new
+        ASFJSON.compare_json(JSON.parse(@old_file), 
JSON.parse(results),jsonout)
+        sendMail("Difference(s) in JSON #{file} (ALPHA)", jsonout.string)
+      rescue StandardError => e
+        Wunderbar.warn "Failed trying to compare JSON: #{e}"
+      end
     else
       @changed = ChangeStatus::NEW
     end

Reply via email to