RESTful Interface for Perforce Systems
rest4p defines a framework for interacting with Perforce and Perforce products
using a REST-based interface. Results are returned as pretty-formated JSON
- Ruby 1.9 or higher
- Install all of the dependencies
- In the directory containing the source run:
ruby -I . rest4p.rb
Using by default: http://localhost:4567
1) Create a session object
This will return a basic form which will POST the create request
Session information is stored in a session-only cookie called PUP. No
Information is saved on the rest4p server machine. DELETE /_session
will remove the cookie.
2) Use session to run commands. Currently the following are implemented:
a) Singular and plural form commands for reading
e.g., p4 change GET /p4/changes GET /p4/change/name
b) Risky editing of forms
e.g., p4 client foobar POST /p4edit/client/foobar
body being JSON encoded form
Provides a GET /p4edit/FORM/NAME form to generate a POST
Arguments can be passed using URL '?arg1=value&arg2' syntax.
Note: -i, -o, and -d argments are ignored.
3) GET /env will return a blob of information
p4if.rb: Defines the interface used to access Perforce
rest4p.rb: Defines the sinatra DSL for this RESTful interface
views/session.erb: Defines the simple session form
p4d-init.sh: Create two p4d services: one unicode, one not.