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
objects.
Dependencies:
- Ruby 1.9 or higher
- Sinatra
- P4Ruby
Install:
- Install all of the dependencies
- In the directory containing the source run:
ruby -I . rest4p.rb
Using by default: http://localhost:4567
Using:
1) Create a session object
GET /_session
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.
2) Use session to run commands. Currently the following are implemented:
p4 change GET /p4/changes GET /p4/change/name
p4 counter -ditto-
p4 depot
p4 job
p4 key
p4 stream
p4 user
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
Internals:
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.