lita-locker

Build Status MIT License RubyGems :: RMuh Gem Version Coveralls Coverage Code Climate Gemnasium

Locking, unlocking shared resource handler for lita.io.

Installation

Add lita-locker to your Lita instance's Gemfile:

gem "lita-locker"

Configuration

None

Usage

lita-locker allows you to define resources (such as a server, or Git repo), and labels (such as "production"). Labels can have multiple resources, and resources can be referenced by multiple labels. A label can only be locked if all of the resources it uses are available.

Examples

lock web                - Make something unavailable to others
unlock web              - Make something available to others
steal web               - Make yourself the owner of something locked by someone else
locker status web       - Show the current state of web

Locking, Unlocking, State

lock <label>         - A basic reservation, with no time limit. Can have # comments afterwards.
unlock <label>       - Remove a reservation.  This can only be done by whomever made the request. Can have # comments afterwards.
steal <label>        - Force removal of a reservation.  This can be done by anyone. Can have # comments afterwards.

Queueing

lock <label> - If <label> is already locked, adds you to a FIFO queue of pending reservations for <label>
locker dequeue <label> - Remove yourself from the queue for <label>

Labels

locker label list                          - List all labels
locker label create <name>                 - Create a label with <name>.
locker label delete <name>                 - Delete the label with <name>.  Clears all locks associated.
locker label add <resource> to <name>      - Adds <resource> to the list of things to lock/unlock for <name>
locker label remove <resource> from <name> - Removes <resource> from <name>
locker label show <name>                   - Show all resources for <name>

Resources

locker resource list          - List all resources
locker resource create <name> - Create a resource with <name>.  (Restricted to locker_admins group)
locker resource delete <name> - Delete the resource with <name>.  Clears all locks associated.  (Restricted to locker_admins group)
locker resource show <name>   - Show the state of <name>

HTTP access

curl http://lita.example.com/locker/label/<name>    - Get current <name> status
curl http://lita.example.com/locker/resource/<name> - Get current <name> status

License

MIT