Created
June 17, 2012 22:37
-
-
Save gilesbowkett/2945951 to your computer and use it in GitHub Desktop.
Heroku-style dev on EC2 || Slicehost || whatev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'json' | |
class GitHubUpdater | |
def self.update?(json) | |
(JSON.parse(json)["ref"] == "refs/heads/master") | |
end | |
def self.git_pull | |
`cd /project/directory && git checkout master && git pull origin master` | |
end | |
end | |
set :port, 54321 | |
post '/' do | |
GitHubUpdater.git_pull if GitHubUpdater.update?(params[:payload]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment