atmos/heaven — pull request #20 by atmos (2014-03-29 22:34:12+00:00)
Title: Completed Deployment model

This starts capturing a composite key structure so we can look back at older deployments and see if we should auto-deploy incoming commit statuses.

The four important attrs are `ref`, `sha`, `environment`, and `name`.

```ruby
status = commit_status
deployments = Deployment.distinct_by_name_with_owner_and_name_and_environment

if combined_status_successful_for_sha?(status.sha)
deployments.each do |deployment|
if deployment.auto_deployable?
if deployment.ref.contains?(status.sha)
if deployment.behind?(status.sha)
# issue a deployment request to github with the deployment payload and incoming status sha
```