Its all about Ruby On Rails
Ruby Script for SVN commit notification with log message, list of updated files and readable colored SVN Diff
Some days ago I wrote a post about “SVN commit notification” which uses a perl script for sending commit notification with svn diff by mail. In this mail you can find svn diff from the last committed revision. I used to love this mail, soon I realized that it is a bit ugly and difficult to read. Also there were some important information missing. Like the name of user committing the code, the log message etc…
And then I started writing my own ruby script for same purpose but with some addition and modification. Commit Notification Script is that script, you can download and configure it with your SVN post commit hook as follows.
Add following line at the bottom of your post-commit file:
/usr/bin/ruby /var/www/repositories/project/hooks/commit-email.rb "$1" "$2"
* Please remember to change the path of you commit-email ruby script.
Now open commit-email ruby file and modify the following section according to your requirement:
# You can edit below
# Subject prefix
sub = "[test_project@vinsol]" # A project 'test_project' is maitained at vinsol
#list of users who will recieve commit notification
recipients = ["bansalakhil30.10@gmail.com", "akhil@vinsol.com"]
# email which will appear in from email field
from_user = "svn-notify@somedomain.com"
# your smtp settings here
ActionMailer::Base.smtp_settings = { :address => 'localhost', :port => 25, :domain => 'domain.com'}
# Do not edit below this line
You are done with that, now onwards whenever someone commits the code, you’ll get the commit notification mail like:

January 15, 2008 - 2:32 am
Can you upload or pastie this somewhere else? Your blog isn’t letting me download it – I get a 500 error from your download script.
January 15, 2008 - 10:43 am
Hi Brian,
Thanks for letting me know about that. It is now fixed.
February 15, 2008 - 10:03 pm
This is a great base for what I’ve wanted as a post-commit script.
It would be nice if there were options for ViewVC-type links, and other things.
I’ve added that stuff hard-coded to my situation, but I may go back through and make them more generic. Are those changes something you be interested in seeing back, or are you at the “wash my hands of it” stage?
March 4, 2008 - 5:30 am
Just in case someone using this isn’t familiar with ActionMailer, you can configure it to authenticate against a mail server like so:
ActionMailer::Base.smtp_settings = {
:address => “mail server address”,
:port => 25,
:domain => “mail domain”,
:authentication => :login,
:user_name => “mail account”,
:password => “password”
}
June 4, 2008 - 10:34 am
We’ve found this script incredibly helpful – many thanks! But we’ve just switched to git, and miss it terribly… has anyone ported this to git?
September 10, 2008 - 3:13 am
I am unable to download the commit-email.rb script. The link redirects to http://webonrails.com/wp-content/plugins/wp-downloadMonitor/user_uploads/commit-email. Any ideas?
Thanks.
September 10, 2008 - 11:13 am
Hi Stirling,
Check it now
September 12, 2008 - 2:06 am
Awesome. Thanks. This is fantastic.
March 14, 2009 - 2:54 am
Thanks for the handy script. Our organization finally gave me the go-ahead to upgrade everything to SVN and I am wanting to learn Ruby to support what I do (Configuration Management). I appreciate the post!