-
-
Save cooljl31/de5a781a477307a20ff6aaf6216026ab to your computer and use it in GitHub Desktop.
Heroku-style dev on EC2 || Slicehost || whatev
This file contains hidden or 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