Notify team members of relevant changes

To help team members keep track of changes that affect their own work, you can use postoperation triggers to send notifications of various events. For example, when developers change the graphic user interface (GUI), an e-mail message to the documentation group ensures that these changes are documented.

To enforce this policy, create a trigger type that sends mail, and then attach the trigger to the relevant elements.

Trigger definition on Linux and the UNIX system

cleartool mktrtype –nc -element –postop checkin \
   –exec /public/scripts/informwriters.sh InformWriters
Created trigger type "InformWriters".

Trigger action script on Linux and the UNIX system

#!/bin/sh
#
#Init
tmp=/tmp/checkin_mail

# construct mail message describing checkin

cat > $tmp <<EOF
Subject: Checkin $CLEARCASE_PNAME by $CLEARCASE_USER
$CLEARCASE_XPNAME
Checked in by $CLEARCASE_USER.

Comments:
$CLEARCASE_COMMENT
EOF

# send the message

mail docgrp <$tmp

# clean up

#rm -f $tmp 

Trigger definition on the Windows® system

cleartool mktrtype –nc -element –postop checkin ^
–exec "ccperl \\neon\scripts\informwriters.pl" InformWriters
Created trigger type "InformWriters".

Trigger action script on the Windows system

use Net::SMTP;

my $smtp = new Net::SMTP ’neon.purpledoc.com’;

$smtp->mail(’DevOps Code ClearCase® Admin’);
$smtp->to(’DevOps Code ClearCase Admin’);
$smtp->to(’docgrp’);

$smtp->data();
$smtp->datasend("From: DevOps Code ClearCase Admin\n");
$smtp->datasend("To: docgrp\n");
$smtp->datasend("Subject: checkin\n");
$smtp->datasend("\n");

# create variables for path/user/comment

$ver = $ENV{CLEARCASE_XPN’};
$user = $ENV{CLEARCASE_USER’};
$comment = $ENV{CLEARCASE_COMMENT’};

$var = "Version: $ver\nUser: $user\nComment: $comment\n";

$smtp->datasend($var);
$smtp->dataend();
$smtp->quit;