<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>File: checktype.rb</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel=StyleSheet href=".././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript" language="JavaScript"> <!-- function popCode(url) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } //--> </script> </head> <body bgcolor="white"> <table summary="Information on file" width="100%"> <tr class="title-row"> <td><table summary="layout" width="100%"><tr> <td class="big-title-font" colspan="2">checktype.rb</td> <td align="right"><table summary="layout" cellspacing="0" cellpadding="2"> <tr> <td class="small-title-font">Path:</td> <td class="small-title-font">checktype.rb</td> </tr> <tr> <td class="small-title-font">Modified:</td> <td class="small-title-font">Fri Sep 26 16:43:30 BST 2003</td> </tr> </table> </td></tr></table></td> </tr> </table> <!-- banner header --> <div class="description"><h1>Introduction</h1> <h2>Name: <a href="checktype_rb.html">checktype.rb</a></h2> <h2>Author: Tony Smith <tony@perforce.com></h2> <h2>Description</h2> <pre> Example trigger to enforce a rule "files of suffix .x need to be added as type Z". (For example, ".jpg" files must always be "binary" and ".sh" files should always be "text".) This script is mostly a reimplentation of Jeff Bowles and Wed Peters' Perl binary.pl using P4Ruby but it uses a more generalised trigger execution framework to make it easier to concentrate on the nuts and bolts of what your trigger does. </pre> <h2>Requires</h2> <pre> Ruby P4Ruby P4Triggers module </pre> <h2>Example ‘triggers’ section:</h2> <pre> Note: since this is applicable to only filenames with certain suffixes, you might want to restrict the trigger to run when those files are submitted. So, if this is looking at .cpp/.h/.txt/.html lines, you might want to have it run only on those files.) Triggers: exampleB //.../*.jpg "ruby whatever/checktype.rb %changelist%" exampleB //.../*.bmp "ruby whatever/checktype.rb %changelist%" exampleB //.../*.sh "ruby whatever/checktype.rb %changelist%" </pre> <h2>Note</h2> <pre> For triggers I recommend you use a P4CONFIG file rather than hard coding username/password in the script itself. This script assumes you've taken that advice. </pre> </div> <table summary="Requires" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Required files</td></tr> </table> <div class="name-list"> <a href="../classes/P4.html">P4</a> <a href="P4Triggers_rb.html">P4Triggers</a> </div> <table summary="List of classes" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Classes and Modules</td></tr> </table> <div class="classlist"> Class <a href="../classes/TypeTrigger.html" class="link">TypeTrigger</a><br /> </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. |