Commit 40e810bd8fc35a4251b544cd2243537d37e9b245:
    Testing diff mails

Branch: refs/heads/master
Author: Sebb <[email protected]>
Committer: Sebb <[email protected]>
Pusher: sebb <[email protected]>

------------------------------------------------------------
www/roster/public_json_common.rb                             | ++++++++ --
------------------------------------------------------------
18 changes: 15 additions, 3 deletions.
------------------------------------------------------------


diff --git a/www/roster/public_json_common.rb b/www/roster/public_json_common.rb
index 6ae56fe..7f86db5 100644
--- a/www/roster/public_json_common.rb
+++ b/www/roster/public_json_common.rb
@@ -80,9 +80,21 @@ def write_output(file, results)
       begin
         out, err, rc = Open3.capture3('diff', '-u', file, '-',
           stdin_data: results + "\n")
-        puts "\n#{out}\n" if err.empty? and rc.exitstatus == 1
-        rescue
-          # ignore failure here
+        if err.empty? and rc.exitstatus == 1
+          puts "\n#{out}\n"
+          require 'mail'
+          ASF::Mail.configure
+          mail = Mail.new do
+            from '[email protected]'
+            to '[email protected]' # For testing purposes, will be changed to 
[email protected]
+            subject "Difference(s) in #{file}"
+            body "\n#{out}\n"
+          end
+          # deliver mail
+          mail.deliver!
+        end
+      rescue
+        # ignore failure here
       end
     end
   

Reply via email to