12.7 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 GUI, an e-mail message to the doc group ensures that these changes are documented.

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

Trigger Definition:

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

Trigger Action Script:

use Net::SMTP;

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

$smtp->mail('ClearCase Admin');
$smtp->to('ClearCase Admin');
$smtp->to('docgrp');

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

# create variables for pathname/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;

To attach triggers to existing elements:

  1. Place the trigger on the inheritance list of all existing directory elements within the GUI source tree:

  2. cleartool find \gui_src -type d ^
    -exec "cleartool mktrigger -nattach InformWriters %CLEARCASE_PN%"

  3. Place the trigger on the attached list of all existing file elements within the GUI source tree:

  4. cleartool find \gui_src -type f ^
    -exec "cleartool mktrigger InformWriters %CLEARCASE_PN%"