CocoaPods/trunk.cocoapods.org — pull request #15 by floere (2014-02-14 16:31:37+00:00)
Title: SubmissionJob refactored into Commit and PushJob.

Resulting in this data structure:

```
create_table(:commits) do
primary_key :id
String :specification_data, :text=>true, :null=>false
TrueClass :pushed, :default=>nil # The single point of "has it been pushed"?
String :sha, :size=>255 # This can be null if it hasn't been pushed yet.
DateTime :created_at
DateTime :updated_at
foreign_key :pod_version_id, :pod_versions, :null=>false, :key=>[:id]
end

create_table(:push_jobs) do
primary_key :id
DateTime :created_at
DateTime :updated_at
foreign_key :commit_id, :commits, :key=>[:id]
foreign_key :owner_id, :owners, :null=>false, :key=>[:id] # We need to know who initiated the push.
end
```

`Commit` is now the only holder of status (pushed/published). It also holds the actual payload. It now doesn't have to have a SHA. That will be assigned by a successful `PushJob.push!` or a Github post-receive-hook.

`PushJob` has an owner and knows which commit it tries to push.

Some caveats I just thought of, which we might have to fix before pulling this in:

* Currently, if a `PushJob` is successful, it will set `Commit#pushed` to `true`. If another `PushJob` is started, it may well set `Commit#pushed` to false. We need to make `Commit#pushed` a latch which cannot be changed back once `true`.