P4 API for Ruby

P4 API for Ruby is an extension to the Ruby programming language that allows you to run P4 Server commands from within Ruby scripts, and get the results in a Ruby-friendly format.

The main features are:

  • Get P4 Server data and forms in hashes and arrays.
  • Edit P4 Server forms by modifying hashes.
  • Exception based error handling.
  • Controllable handling of warnings such as "File(s) up-to-date." on a sync.
  • Run as many commands on a connection as required.
  • The output of a command is returned as a Ruby array. For non-tagged output, the elements of the array are strings. For tagged output, the elements of the array are Ruby hashes. For forms, the output is an array of P4::Spec objects.
  • Thread-safe and thread-friendly; you can have multiple instances of the P4 class running in different threads.
  • Exception-based error handling. Trap P4Exceptions for complete, high-level error handling.