<html> <head> <title>P4/Ruby - P4 class</title> <style type="text/css"> H4 { color: grey } #classhdr { font-weight: bold; background-color: black; color: white } #classtag { font-size: 10; } #classname { font-size: 16; } #classparent{ font-size: 14; } </style> </head> <body> <p align="right"> <a href="index.html">Contents</a> </p> <table border="0" width="100%" id="classhdr"> <tr> <td id="classtag">Class</td> <td> </td> <td> </td> <td id="classname">P4</td> <td id="classparent" width="100%">< Object</td> </tr> </table> <h4>Description</h4> Main interface to the Perforce client API. <h4>See Also</h4> <a href="P4Exception.html">P4Exception</a> <a href="P4DepotFile.html">P4DepotFile</a> <a href="P4Revision.html">P4Revision</a> <a href="P4Integration.html">P4Integration</a> <h4>Class Methods</h4> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>identify</h5> </td> <td align="right"> <i>P4</i>.identify -> <i>aString</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Return the version of P4/Ruby you are using - for diagnostic purposes. <pre> ruby -rP4 -e 'puts( P4.identify )' </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>new</h5> </td> <td align="right"> <i>P4</i>.new -> <i>aP4</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Constructs a new P4 object. <pre> p4 = P4.new() </pre> <h4>Instance Methods</h4> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>client</h5> </td> <td align="right"> <i>p4</i>.client( <i>aString</i> ) -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Synonym for P4#client= <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>client=</h5> </td> <td align="right"> <i>p4</i>.client = <i>aString</i> -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Set the name of the clientspec you wish to use. If not called, defaults to the value of P4CLIENT taken from any P4CONFIG file present, or from the environment as per the usual Perforce convention. Must be called before you connect. <pre> p4 = P4.new p4.client = "www" # or p4.client( "www" ) p4.connect p4.run_sync p4.disconnect </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>client?</h5> </td> <td align="right"> <i>p4</i>.client? -> <i>aString</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Get the name of the Perforce client currently in use <pre> p4 = P4.new puts( p4.client? ) </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>cwd</h5> </td> <td align="right"> <i>p4</i>.cwd( <i>aString</i> ) -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Synonym for P4#cwd= <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>cwd=</h5> </td> <td align="right"> <i>p4</i>.cwd = <i>aString</i> -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Sets the current working directory. Can be called prior to executing any Perforce command. Sometimes necessary if your script executes a chdir() as part of its processing. <pre> p4 = P4.new p4.cwd( "/home/tony" ) # or p4.cwd = "/home/tony" </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>cwd?</h5> </td> <td align="right"> <i>p4</i>.cwd? -> <i>aString</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Get the current working directory <pre> p4 = P4.new puts( p4.cwd? ) </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>debug</h5> </td> <td align="right"> <i>p4</i>.debug( <i>aNumber</i> ) -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Enable/disable debugging support. Debug output is written to $stderr. Pass 1 to enable, 0 to disable. <pre> p4 = P4.new p4.debug( 1 ) p4.connect p4.run_sync p4.disconnect </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>errors</h5> </td> <td align="right"> <i>p4</i>.errors -> <i>anArray</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Returns the array of errors which occurred during execution of the previous command. <pre> p4 = P4.new begin p4.connect p4.exception_level( 1 ) # to ignore "File(s) up-to-date" p4.run_sync rescue P4Exception p4.errors.each { |e| puts( e ) } ensure files = p4.output p4.disconnect end </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>exception_level?</h5> </td> <td align="right"> <i>p4</i>.exception_level? -> <i>aNumber</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Returns the current exception level. <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>exception_level</h5> </td> <td align="right"> <i>p4</i>.exception_level( <i>aNumber</i> ) -> <i>aNumber</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Synonym for P4#exception_level= <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>exception_level=</h5> </td> <td align="right"> <i>p4</i>.exception_level = <i>aNumber</i> -> <i>aNumber</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Configures the events which give rise to exceptions. <p> Setting the exception level to zero disables all exception raising and makes the interface completely procedural. <p> Setting the exception level to 1 causes exceptions to be raised when errors are encountered. <p> Setting the exception level to 2 causes exceptions to be raised for both errors and warnings. This is the default. <pre> p4 = P4.new p4.exception_level = 1 # or p4.exception_level( 1 ) p4.connect # P4Exception on failure p4.run_sync # File(s) up-to-date is a warning so # no exception is raised p4.disconnect </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>host</h5> </td> <td align="right"> <i>p4</i>.host( <i>aString</i> ) -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Synonym for P4#host= <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>host=</h5> </td> <td align="right"> <i>p4</i>.host = <i>aString</i> -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Set the name of the current host. If not called, defaults to P4HOST taken from any P4CONFIG file in effect, then P4HOST in the environment and finally the operating system host name. <pre> p4 = P4.new p4.host = "perforce.smee.org" # or p4.host( "perforce.smee.org" ) p4.connect ... p4.disconnect </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>host?</h5> </td> <td align="right"> <i>p4</i>.host? -> <i>aString</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Get the current hostname <pre> p4 = P4.new puts( p4.host? ) </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>input</h5> </td> <td align="right"> <i>p4</i>.input( aString ) -> true or false<br> <i>p4</i>.input( aHash ) -> true or false<br> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Call prior to running a command of the form "p4 cmd -i" to provide input to Perforce. You may pass a string, or a hash returned from a previous "p4 cmd -o" when using parse_forms mode. <pre> p4 = P4.new p4.parse_forms p4.connect change = p4.run_change( "-o" ).shift change[ "Description" ] = "Autosubmitted changelist" p4.input( change ) p4.run_submit( "-i" ) p4.disconnect </pre> Note that P4#input may raise a P4Exception in exception levels 1 and 2 if errors are encountered parsing the supplied data. Otherwise, returns true if the input is acceptable. <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>output</h5> </td> <td align="right"> <i>p4</i>.output -> <i>anArray</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Get the results of the previous command. Returns an array containing the output of the command. Useful in a rescue block when a command has partially worked, and you still need to look at the command output. <pre> p4 = P4.new begin p4.connect p4.exception_level( 1 ) # to ignore "File(s) up-to-date" files = p4.run_sync rescue P4Exception => ex files = p4.output if files.length puts( "Sync succeeded with errors" ) else puts( "Sync failed!" ) end ensure p4.disconnect end </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>parse_forms</h5> </td> <td align="right"> <i>p4</i>.parse_forms -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Extends the capabilities of tagged output to include Perforce forms. Forms returned by Perforce in response to commands such as "p4 client -o" will be parsed and returned to the caller as a Ruby hash containing keys for each of the fields on the form. Where a form element may contain more than one value, the hash value is an array containing the form elements. parse_forms implies the use of tagged. <pre> p4 = P4.new p4.parse_forms p4.connect clientspec = p4.run_client( "-o" ).shift puts( clientspec[ "Options" ] ) p4.disconnect </pre> Such parsed forms are also acceptable as input to commands of the form "p4 XXXX -i". For example, to change the root of a clientspec you could use: <pre> p4 = P4.new p4.parse_forms p4.connect spec = p4.run_client( "-o" ).shift spec[ "Root" ] = "/home/my/new/root" p4.input( spec ) p4.run_client( "-i" ) p4.disconnect </pre> Note though that you cannot simply construct any old hash and pass it in as input using this feature because the hashes created by parse_forms also contain an extra field "_specdef" which contains the form definition and this is needed to reconstruct a form from the hash. Always use a "-o" followed by a "-i". <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>password</h5> </td> <td align="right"> <i>p4</i>.password( <i>aString</i> ) -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Synonym for P4#password= <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>password=</h5> </td> <td align="right"> <i>p4</i>.password = <i>aString</i> -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Set your Perforce password, in plain text. If not used, takes the value of P4PASSWD from any P4CONFIG file in effect, or from the environment according to the normal Perforce conventions. <pre> p4 = P4.new p4.password = "mypass" # or p4.password( "mypass" ) p4.connect </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>password?</h5> </td> <td align="right"> <i>p4</i>.password? -> <i>aString</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Get the current password - in plain text. <pre> p4 = P4.new puts( p4.password? ) </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>port</h5> </td> <td align="right"> <i>p4</i>.port( <i>aString</i> ) -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Synonym for P4#port= <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>port=</h5> </td> <td align="right"> <i>p4</i>.port = <i>aString</i> -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Set the host and port address of the Perforce server you want to connect to. If not called, defaults to the value of P4PORT in any P4CONFIG file in effect and then to the value of P4PORT taken from the environment. <pre> p4 = P4.new p4.port = "localhost:1666" # or p4.port( "localhost:1666" ) p4.connect ... p4.disconnect </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>port?</h5> </td> <td align="right"> <i>p4</i>.port? -> <i>aString</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Get the address of the current Perforce server. <pre> p4 = P4.new puts( p4.port? ) </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>run</h5> </td> <td align="right"> <i>p4</i>.run( <i>aCommand</i>, <i>arguments...</i> ) -> <i>anArray</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Base interface to all the run methods in this API. Runs the specified Perforce command with the arguments supplied. Arguments may be in any form you like as long as it responds nicely to "to_s". <p> If the command succeeds without errors or warnings, then run returns an array of results. Whether the elements of the array are strings or hashes depends on (a) the command executed and (b) whether tagged() or parse_forms() have been called. <p> The array that is returned is equivalent to that returned by "p4.output". <p> In the event of errors or warnings, and depending on the exception level in force at the time, run will raise a P4Exception. If the current exception level is below the threshold for the error/warning, then run returns the output as normal and the caller must explicitly review p4.errors and p4.warnings to check for errors or warnings. <pre> p4 = P4.new p4.connect spec = p4.run( "client", "-o" ).shift p4.disconnect </pre> Through the magic of Object#method_missing, you can save yourself some typing as <pre> p4.run_XXX( args ) </pre> is translated into <pre> p4.run( "XXX", args ) </pre> There are also some shortcuts for common commands such as editing Perforce forms and submitting. So this: <pre> p4 = P4.new p4.parse_forms p4.connect <b>clientspec = p4.run_client( "-o" ).shift</b> clientspec[ "Description" ] = "Build client" <b>p4.input( clientspec ) p4.run_client( "-i" )</b> p4.disconnect </pre> May be shortened to <pre> p4 = P4.new p4.parse_forms p4.connect <b>clientspec = p4.fetch_client</b> clientspec[ "Description" ] = "Build client" <b>p4.save_client( clientspec )</b> p4.disconnect </pre> In fact, the following are equivalent: <p> <table border=1 cellpadding="10"> <tr> <td>p4.fetch_xxx</td> <td>p4.run_xxx( "-o ").shift</td> </tr> <tr> <td>p4.save_xxx( spec )</td> <td>p4.input( spec )<br> p4.run_xxx( "-i" ).shift </td> </tr> </table> <p> Note that the fetch_xxx methods do not return an array as typically there is only one result item from such commands. Accordingly, they return the first result element. <p> There is also a special shortcut for submitting <pre> p4 = P4.new p4.parse_forms p4.connect spec = p4.fetch_change spec[ "Description" ] = "Automated change" <b>p4.submit_spec( spec )</b> p4.disconnect </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>tagged</h5> </td> <td align="right"> <i>p4</i>.tagged -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Enables tagged output. Responses to Perforce commands which support tagged output will be converted into Ruby hashes. Must be called before connecting to the server. <pre> p4 = P4.new p4.tagged p4.connect ... p4.disconnect </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>user</h5> </td> <td align="right"> <i>p4</i>.user( <i>aString</i> ) -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Synonym for P4#user= <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>user=</h5> </td> <td align="right"> <i>p4</i>.user = <i>aString</i> -> true </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Set your Perforce username. If not set defaults to the value of P4USER taken from any P4CONFIG file in effect, then the value of P4USER in your environment and lastly your operating system user name. <pre> p4 = P4.new p4.user = "tony" # or p4.user( "tony" ) p4.connect ... p4.disconnect </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>user?</h5> </td> <td align="right"> <i>p4</i>.user? -> <i>aString</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Returns your current Perforce user name <pre> p4 = P4.new puts( p4.user? ) </pre> <p> <img src="dot.gif" width="100%" height="3"> <table border="0" width="100%"> <tr> <td rowspan="2" width="150"> <h5>warnings</h5> </td> <td align="right"> <i>p4</i>.warnings -> <i>anArray</i> </td> </tr> <tr> <td><img src="dot.gif" height="1" width="100%"></td> </tr> </table> <br> Returns the array of warnings which arose during execution of the last command. <pre> p4 = P4.new begin p4.connect p4.exception_level( 0 ) # "File(s) up-to-date" is a warning files = p4.run_sync rescue P4Exception => ex p4.warnings.each { |w| puts( w ) } ensure p4.disconnect end </pre> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#21 | 5791 | Tony Smith |
Add experimental support for passing a block to P4#run_resolve. The block is passed a P4::MergeData object encapsulating the context of each merge performed. The block should evaluate to a string indicating the desired result of the merge: 'ay', 'at', 'am', 's', etc. The P4::MergeData object contains information about the files involved in the merge and can invoke an external merge tool. This is still experimental at this stage so the interface may change as it evolves. |
||
#20 | 5311 | Tony Smith |
Add new P4#api= method to allow users to lock scripts to a particular API level. This helps when upgrading to new servers that extend support for tagged output to hitherto unsupported commands (2005.2 did a lot of that). See the C/C++ API Release Notes for the full details, but by way of example, to lock scripts to the 2005.1 interface use: p4.api = 57 |
||
#19 | 5222 | Tony Smith |
Improve debug output in P4Ruby: p4.debug = 1 * Show commands being executed p4.debug = 2 * Show function calls p4.debug = 3 * Show data p4.debug = 4 * Show ruby garbage collection calls. Debug levels are cumulative as you'd expect. |
||
#18 | 5169 | Tony Smith | Add missing parse_forms() call to example | ||
#17 | 4942 | Tony Smith |
Add support for Unicode servers to P4Ruby. This change adds two new interfaces, P4#charset= and P4#charset? to set and get the charset respectively. |
||
#16 | 4830 | Tony Smith |
Add named constants for P4Ruby's exception levels. The valid levels are: P4::RAISE_NONE -- No exceptions P4::RAISE_ERRORS -- Exceptions on errors only P4::RAISE_ALL -- Exceptions on errors and warnings Also added P4#at_exception_level( level ) { ... } method to allow you to run a block of code at a different exception level and revert to the previous level when the block completes. Thanks to Johan Nilsson. Some doc tidying along with the docs for the features above. |
||
#15 | 4810 | Tony Smith |
Fix the anchor names in the docs. Correction to previous change. |
||
#14 | 4809 | Tony Smith |
Add P4#maxresults= and P4#maxscanrows= methods to allow you to place explicit limits on the execution of individual commands. These limits remain in force for all subsequent commands until they are removed by setting them to zero. Port of new functionality from P4Perl. |
||
#13 | 4753 | Tony Smith |
Add support for executing commands which prompt the user for input more than once during their execution. A perfect example is 'p4 password' which prompts the user three times. This works by allowing P4#input() to take an array argument. Each time Perforce prompts the user (by calling ClientUserRuby::Prompt()), the array is shifted by one and the first value in the array is passed to Perforce. Thus, to change your password a three-element array is needed comprising of your old password, and the new password twice. To make this a little easier on the eye, this change also includes a thin wrapper called P4#run_password() which takes simply the old password and the new password and constructs a suitable input array. This change also includes docs for the above, and docs for P4#run_filelog() which were found to be missing. |
||
#12 | 4680 | Tony Smith |
Make P4Ruby return new P4::Spec objects instead of plain old hashes when parse_forms mode is in use. A P4::Spec object is derived from Hash so should be backwards compatible with previous code. P4::Spec provides limited fieldname validation on forms and accessor methods for quick and easy access to the fields in the form. The accessor methods are all prefixed with '_' to avoid colliding with methods from the Hash parent class. This is a little ugly, but deriving from hash is a big win, so it's worth it. This change also fixes a minor bug found along the way. Spec parsing and formatting wouldn't work with labels, branches, depots and groups unless you'd previously run a P4::fetch_label( <label> ), P4::fetch_branch( <branch> ) etc. etc. This is because the spec parsing code internally runs one of these commands in order to grab the specdef from the server but it wasn't providing a spec name. i.e. it was using 'p4 client -o' and assuming that this would work for other types of spec too. It does, but not for all spec types. So, now the spec parsing code will use a bogus name for the spec types that require it. |
||
#11 | 4653 | Tony Smith |
More documentation tweaks. Just makes the pages look more like the reference pages in the 'Pickaxe book' |
||
#10 | 4652 | Tony Smith |
Doc update for P4Ruby. Rework the html and the CSS to make the docs a little easier on the eye and easier to use too. |
||
#9 | 4651 | Tony Smith |
Add format_spec() method and format_* shortcuts to make it easy to convert a spec in a hash back to its string form without sending it to the server. |
||
#8 | 4593 | Tony Smith |
Add support for 'p4 login' to P4Ruby per request from Robert Cowham. New installer to follow. |
||
#7 | 4589 | Tony Smith |
Update P4Ruby to support the new SetProg() method in the 2004.2 API. Whilst the new 'P4#prog=' method is always available, it's only functional if P4Ruby is built with a 2004.2 or later API. The build system got a bit of tidying up to support this change and the API version is now detected automatically if possible. I've also removed the --apilibdir and --apiincludedir flags as they complicate matters and I never use them and I don't believe anyone else does either. There are also some minor doc formatting tweaks to go along with the added documentation for prog=. |
||
#6 | 4261 | Tony Smith |
Add support for parsing arbitrary specs from strings in Ruby space. Useful with spec depots. You might obtain the spec by running a "p4 print -q" against a file in a spec depot, but want to parse it into a Ruby hash. i.e. p4 = P4.new p4.parse_forms # Required! p4.connect buf = p4.run_print( "-q", "//specs/client/myclient" ) spec = p4.parse_client( buf ) # Or equivalently spec = p4.parse_spec( "client", buf ) |
||
#5 | 4255 | Tony Smith |
P4Ruby doc reformatting. Now uses CSS instead of 1x1 image and too many tables. Could no doubt be improved upon, but it's a start. |
||
#4 | 2426 | Tony Smith | Doc beautifying for P4Ruby. | ||
#3 | 2085 | Tony Smith |
Get rid of specdef hack in the Ruby API. No need to store it in the hash, just grab it from the RPC buffer when needed. |
||
#2 | 1426 | Tony Smith |
Cleaned up the debug output a little. Introduced some debug levels so you can decide (roughly) what output you want to see. Level 1 shows command execution, connect and disconnect. Level 2 includes Level 1 and also shows the RPC callbacks as they happen. Level 3 includes 1 and 2 and also shows when Ruby garbage collection takes place. Converted all the simple methods of the form P4#meth( arg ) to aliases for P4#meth=. Added P4#debug= to complete the scheme. The P4#meth( arg ) forms are now deprecated. i.e. you should use: p4.user = "tony" and not: p4.user( "tony" ) It's just more Ruby-like. |
||
#1 | 1324 | Tony Smith |
P4/Ruby documentation update. Changed doc layout and added in docs for newly added methods and classes. |
||
//guest/tony_smith/perforce/API/Ruby/main/P4.html | |||||
#3 | 1166 | Tony Smith |
Followup to previous change. Simplify the interface to getting results/errors and warnings. No need for the P4Result class anymore so that's gone (though it's still there as a C++ class because it's useful) and so is P4#result. Now you get your errors/warnings and results using P4#errors, P4#warnings and P4#output all of which return arrays. |
||
#2 | 1165 | Tony Smith |
Minor reshuffle. Added the ability to disable exceptions completely if you don't like them or to have them raised only for errors (and not for warnings). Removed P4#warnings interface and replaced it with P4#exception_level. Some minor doc tweaks to go with the above change |
||
#1 | 1164 | Tony Smith |
Reworked exception handling (hopefully for the last time) in P4/Ruby. Now exceptions are raised on completion of Perforce commands if any errors or warnings were received as part of executing the command. This change also adds documentation, and indexes the Ruby interface off my main page. Bad form to combine so many changes in one changelist, but it's getting late and I want to get them submitted! |