<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>File: P4Triggers.rb</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="fileHeader"> <h1>P4Triggers.rb</h1> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Path:</strong></td> <td>P4Triggers.rb </td> </tr> <tr class="top-aligned-row"> <td><strong>Last Update:</strong></td> <td>Mon Sep 20 13:20:13 BST 2004</td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <h1>Introduction</h1> <h2>Name: P4Triggers.rb</h2> <h2>Author: Tony Smith <tony@perforce.com></h2> <h2>Description</h2> <pre> A library for use when writing Perforce triggers. Methods and classes common to all my example triggers are to be found in here. The framework for a trigger is very simple: 1. You derive your trigger class from P4Trigger 2. You implement the validate() method to decide whether or not to allow the submit 3. You send output to the user using the message() method 4. You raise exceptions to report runtime errors P4Exceptions are already handled for you. 5. Your trigger script should call P4Trigger#parse_change() and should use the value returned as its exit status. And that's all there is to it! The P4Change class merits some familiarisation because objects of this class are what you get when you call P4Trigger#change() and it's a very convenient way to examine the changelist being submitted. If you're just getting started with this framework, start by looking at the P4Trigger class and then look at P4Change. </pre> </div> <div id="class-list"> <h2 class="section-bar">Classes and Modules</h2> Class <a href="../classes/FileType.html" class="link">FileType</a><br /> Class <a href="../classes/P4.html" class="link">P4</a><br /> Class <a href="../classes/P4Change.html" class="link">P4Change</a><br /> Class <a href="../classes/P4Trigger.html" class="link">P4Trigger</a><br /> </div> </div> <!-- if includes --> <!-- if method_list --> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 4654 | Tony Smith |
Add an example spec trigger to show how you might restrict the default view for all new clients to a pre-defined set of mappings. |
||
#2 | 4640 | Tony Smith |
Add a sample post-commit trigger that can be used to keep a master and slave branch in sync. |
||
#1 | 3637 | Tony Smith | Add RDoc documentation to the sample triggers. |