puppetlabs/puppet-webhooks — pull request #3 by jeffmccune (2012-12-31 09:41:44+00:00)
Title: Enable workless auto-scaler for worker process

Without this patch workers are not started. With this patch applied the
Heroku API is used to automatically scale the number of worker dynos
listed in the Procfile.

When a new job is queued, a worker process will automatically be created
by setting the scale factor for the worker process to 1. When the
worker is finished with the job it will automatically terminate itself
by setting the scale factor to 0.

These are equivalent to:

heroku scale worker=0

This should result in considerable cost savings since the worker
processes will not persist when the queue is empty.

a722d80 (Jeff McCune, 57 minutes ago)
Fix Heroku database.yml issue, use ERB parsing

4364c3d (Jeff McCune, 2 hours ago)
Create card in Trello only if they don't already exist

Without this patch the delayed jobs don't actually create the cards on
Trello. This patch addresses the problem by implementing some basic
logic. If a card with a matching title already exists on the board the
job does nothing. If the card does not exist with the same title the card
is created.

e00c186 (Jeff McCune, 7 hours ago)
Make /event/pull_request respond with 202 and JSON data

Without this patch the response from the service when posting the pull
request data does not contain any information. This is a problem because
the foreign service doesn't have any indication what happened with the web
hook.

This patch addresses the problem by returning a 202 HTTP status code. This
code means: "The request has been accepted for processing, but the
processing has not been completed. The request might or might not
eventually be acted upon, as it might be disallowed when processing
actually takes place."

In addition, serialized JSON data is returned in the body of the response.
This data contains the job id, priority, and the time the job has been
created for processing.

b46cd0f (Jeff McCune, 14 hours ago)
Queue up Pull Request jobs at /event/pull_request

Without this patch we are not creating and storing jobs that are
executable by DJ. This patch addresses the problem by introducing new
models for the Pull Request data, and associating these models with a
PullRequestJob instance. This instance is then written to the databases
when post data includes the payload parameter routed to
/event/pull_request.

This patch also adds two rake jobs. `api:run` and `api:pull_request`.
These tasks start a local copy of the web server using foreman and thin.
This requires the heroku toolbelt. The `api:pull_request` task uses the
system curl command to an HTTP POST request similar to how Github would
make one when a new pull request is created.

This patch adds a queue_job helper method. This method is intended to be
available using `helpers PuppetLabs::SinatraDJ`. Any object that responds
to `perform` can be queued with queue_job(obj).

In addition, this patch initializes an in-memory SQLite database for spec
testing.

This patch also switches to config.ru and thin