I would like to show you really nice and helpful notification script.
I use it to notify me of new SVN revision, but it can be easily modified and use in some different way.
Here come the script:
#!/usr/bin/env ruby
while true do
tmp = `svn st -u | grep '*' | cut -c 21-`
tmp2 = tmp.split("\n")
tmp3 = `pwd`
tmp3 = tmp3.split('/').last
tmp3.gsub!("\n", "")
if tmp2.size > 0
message = "'#{tmp.gsub("\n", " ")}' #{tmp2.size.to_s} new files in #{tmp3}"
system "growlnotify -n check_svn -m #{message} --image ./worms.png"
puts message
end
puts Time.now.strftime('%Y-%m-%d %H:%M:%S')
sleep(60)
end
So, how it works?
Every 60 seconds we run svn up -u command and if there's something new in repository, we print a list of new files using growlnotify (from Growl package - http://growl.info).
That's all :)
The console output:
... and worm icon:

No comments:
Post a Comment