Skip to content

Instantly share code, notes, and snippets.

@gilesbowkett
Created June 17, 2012 22:37
Show Gist options
  • Save gilesbowkett/2945951 to your computer and use it in GitHub Desktop.
Save gilesbowkett/2945951 to your computer and use it in GitHub Desktop.
Heroku-style dev on EC2 || Slicehost || whatev
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