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. 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
c) Git Fusion interfaces
GET /git-fusion/repos Returns list of repos
GET /git-fusion/repo/NAME Returns p4gf_config for repo
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.