You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/08/19 12:54:45 UTC

[whimsy] 01/04: add a travis mail relay

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

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

commit c155ed97c1323b35d65424a3e17ac39ff1d6e512
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Aug 19 08:43:53 2017 -0400

    add a travis mail relay
---
 tools/travis-relay.rb | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/tools/travis-relay.rb b/tools/travis-relay.rb
new file mode 100644
index 0000000..4e380e9
--- /dev/null
+++ b/tools/travis-relay.rb
@@ -0,0 +1,42 @@
+#
+# forward travis notifications to notifications@whimsical.
+#
+# 'To' header will be replaced
+# 'From' header will effectively be replaced
+# Transport headers names will be prepended with 'X-'
+# Original content headers will be dropped (and recreated).
+#
+
+munge = %w(received delivered-to)
+skip = %w(content-type content-transfer-encoding)
+
+$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
+require 'mail'
+require 'whimsy/asf'
+
+ASF::Mail.configure
+
+original = Mail.new(STDIN.read)
+exit unless original.from.include? "builds@travis-ci.org"
+
+copy = Mail.new
+
+# copy/munge/skip headers
+original.header.fields.each do |field|
+  name = field.name
+  next if skip.include? name.downcase
+  name = "X-#{name}" if munge.include? name.downcase
+
+  if name.downcase == 'to'
+    copy.header['To'] = '<no...@whimsical.apache.org>'
+  else
+    copy.header[name] = field.value
+  end
+end
+
+# copy content
+copy.text_part = original.text_part if original.text_part
+copy.html_part = original.html_part if original.html_part
+
+# deliver
+copy.deliver!

-- 
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.