Skip to content

Instantly share code, notes, and snippets.

@atd
atd / gist:721434
Created November 30, 2010 09:55
cijoe build-failed hook to send emails through sendmail
TO=`git show --pretty=email | grep ^From: | sed -e 's/^From: //'`
echo "From: sender
To: $TO
Cc: other-receiver
Subject: Tests failed!
Application was broken in the last commit!
You can check it at:
http://ci-web-address
# AttachmentFu sets the Attachment content type from the browser sent Content-type header
#
# This monkey patch uses UNIX file utility to fix broken or missing content types headers
module Technoweenie::AttachmentFu::InstanceMethods
def uploaded_data_with_unix_file_mime_type=(file_data)
tmp_file = self.uploaded_data_without_unix_file_mime_type=(file_data)
if tmp_file.present? && (unix_file = `which file`.chomp).present? && File.exists?(unix_file)
`#{ unix_file } -v 2>&1` =~ /^file-(.*)$/