<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>Tony Smith's P4Ruby Library - Perforce Public Depot</TITLE> <META content="text/html; charset=iso8859-1" http-equiv=Content-Type> </HEAD> <BODY bgColor=#ffffff> <table width="100%" border=0> <tr> <td> <img src="../../images/ruby2.jpg"> </td> <td> <H2><font color="#cc3333">P4Ruby Library: Scripts/Modules for use with P4Ruby</font></H2> </td> </tr> </table> <img src="../../images/dot.gif" width="100%" height="1"> <h3><font color="#cc3333">Introduction</font></h3> <p> I've started to put together some commonly used/requested scripts both to provide examples of good scripting using P4Ruby and also to solve some common problems in what I hope is an efficient way. <p> I hope that over time, this will grow into a fairly broad range of resources for Perforce users. <p><img src="../../images/dot.gif" width="100%" height="1"> <h3><font color="#cc3333">Library Contents</font></h3> <ol> <li><a href="#triggers">Triggers</a> </ol> <p><img src="../../images/dot.gif" width="100%" height="1"> <h3><font color="#cc3333">Support</font></h3> If you have any problems or questions with these scripts you can contact me at <a href="mailto:tony@perforce.com">tony@perforce.com</a> or <a href="mailto:tony@smee.org">tony@smee.org</a>. These scripts are not supported by Perforce Software, but by me personally. I'll answer questions as quickly as I can. <p><img src="../../images/dot.gif" width="100%" height="1"> <a name="triggers"> <h3><font color="#cc3333">Triggers</font></h3> These are some example trigger scripts. The documentation for all of these scripts is <a href="triggers/doc/index.html">available here</a>. <p> <table border="1" bordercolor="#cc3333" cellspacing="0" cellpadding="5" width="95%"> <tr> <th>Script</th> <th>Description</th> </tr> <tr> <td><a href="triggers/P4Triggers.rb">P4Triggers.rb</a></td> <td> A generalised framework for implementing Perforce triggers used by all of the other scripts. If you're going to use these scripts at all, you'll need this file to be installed in the same directory as the scripts themselves. </td> </tr> <tr> <td><a href="triggers/checkjob.rb">checkjob.rb</a></td> <td> Ensures that all changelists are associated with a job before they can be submitted. This is the simplest example of using my trigger framework. </td> </tr> <tr> <td><a href="triggers/checktype.rb">checktype.rb</a></td> <td> Ensures that new files being added/branched have the correct Perforce filetypes. Whilst "p4 typemap" goes a long way towards ensuring filetype consistency, it's easily overridden. Since a user cannot override a trigger, sysadmins who want more enforcement may want to use this trigger. </td> </tr> <tr> <td><a href="triggers/checkcase.rb">checkcase.rb</a></td> <td> Script to ensure that new files being added/branched respect the case of existing directories in the path. For example, if //depot/test/fileA already exists, then this script will reject an attempt to add //depot/TEST/fileB or //Depot/test/fileB for that matter. <p> This is very useful if you have Windows clients or if your Perforce server runs on Windows. In an all Unix environment it's not so much of a problem. </td> </tr> </table> <p> <a name="utils"> <h3><font color="#cc3333">Utilities</font></h3> These are some useful non-trigger scripts <p> <table border="1" bordercolor="#cc3333" cellspacing="0" cellpadding="5" width="95%"> <tr> <th>Script</th> <th>Description</th> </tr> <tr> <td><a href="scripts/integrename.rb">integrename.rb</a></td> <td> A script to integrate changes using a branch view and attempt to follow renames in both the source and target branches. Early alpha state at the moment. </td> </tr> <tr> </table> <p> </BODY></HTML>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#11 | 4677 | Tony Smith |
Move P4table.rb to the P4Ruby library and rename it to p4table.rb instead. There's an update coming so this is just the move. |
||
#10 | 4656 | Tony Smith |
Rework the defaultclient.rb trigger to be more robust and more efficient. This involved a certain amount of rework to the P4Triggers.rb module to include functionality that will be useful to other spec triggers - there's a new class P4Trigger::FormFile that helps scripts manage their interaction with the temporary formfile supplied by the server. |
||
#9 | 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. |
||
#8 | 4640 | Tony Smith |
Add a sample post-commit trigger that can be used to keep a master and slave branch in sync. |
||
#7 | 4544 | Tony Smith |
Update index page to make it clearer that you must have P4Ruby to use these scripts. |
||
#6 | 4258 | Tony Smith | Update index page to include new script | ||
#5 | 4254 | Tony Smith | Convert P4Ruby pages to CSS style sheet instead of horrid tags. | ||
#4 | 4249 | Tony Smith |
Add a script to back out a change. Features: * Prepares a fresh pending changelist with the files needed to back out the change. * Attempts to resolve merges for backing out older edits using "p4 resolve -am" * Leaves conflict resolution (if any) to the user Shortcomings are numerous, but include: * Does not (yet) re-branch deleted branched files. * Does not handle filetype changes (yet). The odds of success are highest with new changes. For older changes things are much more complicated and you can expect to have some work to do. |
||
#3 | 4243 | Tony Smith |
Add my script to follow renames when integrating using a branchview. Lots of limitations, and I'm sure it doesn't catch everything but it does try to handle renames in both source and target. |
||
#2 | 3637 | Tony Smith | Add RDoc documentation to the sample triggers. | ||
#1 | 3634 | Tony Smith |
Kick off a library of P4Ruby resources with some sample trigger implementations based on Jeff Bowles and Wes Peters' scripts. These are not strict ports of their scripts to P4Ruby, but are roughly in the same area. |