Commit 736da21e33292fcd1799e4d61342811f08ac860e
1 parent
11173e81
Exists in
master
and in
1 other branch
Support Heroku's HTTP Post deployhook.
Showing
1 changed file
with
18 additions
and
6 deletions
Show diff stats
app/controllers/deploys_controller.rb
| @@ -5,12 +5,24 @@ class DeploysController < ApplicationController | @@ -5,12 +5,24 @@ class DeploysController < ApplicationController | ||
| 5 | 5 | ||
| 6 | def create | 6 | def create |
| 7 | @app = App.find_by_api_key!(params[:api_key]) | 7 | @app = App.find_by_api_key!(params[:api_key]) |
| 8 | - @deploy = @app.deploys.create!({ | ||
| 9 | - :username => params[:deploy][:local_username], | ||
| 10 | - :environment => params[:deploy][:rails_env], | ||
| 11 | - :repository => params[:deploy][:scm_repository], | ||
| 12 | - :revision => params[:deploy][:scm_revision] | ||
| 13 | - }) | 8 | + if params[:deploy] |
| 9 | + deploy = { | ||
| 10 | + :username => params[:deploy][:local_username], | ||
| 11 | + :environment => params[:deploy][:rails_env], | ||
| 12 | + :repository => params[:deploy][:scm_repository], | ||
| 13 | + :revision => params[:deploy][:scm_revision], | ||
| 14 | + } | ||
| 15 | + end | ||
| 16 | + | ||
| 17 | + # handle Heroku's HTTP post deployhook format | ||
| 18 | + deploy ||= { | ||
| 19 | + :username => params[:user], | ||
| 20 | + :environment => params[:rack_env].try(:downcase) || params[:app], | ||
| 21 | + :repository => "git@heroku.com:#{params[:app]}.git", | ||
| 22 | + :revision => params[:head], | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + @deploy = @app.deploys.create!(deploy) | ||
| 14 | render :xml => @deploy | 26 | render :xml => @deploy |
| 15 | end | 27 | end |
| 16 | 28 |