Created
May 26, 2012 09:39
-
-
Save Yuffster/2793154 to your computer and use it in GitHub Desktop.
Continuous Integration Server in < 20 Lines
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' | |
| require 'logger' | |
| before do | |
| #only allow access to GitHub. | |
| ips = ['207.97.227.253', '50.57.128.197', '108.171.174.178']; | |
| halt 404, "D:<" unless ips.find_index(@env['REMOTE_ADDR'])>=0 | |
| end | |
| post '/post-receive' do | |
| branch = JSON.parse(params[:payload])['ref'].split('/').pop | |
| log = Logger.new('log.txt').info(`./update_branch.sh #{branch}`) | |
| end |
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
| #!/usr/bin/env bash | |
| echo updating branch $1... | |
| cd /srv/mysite.com/$1/application | |
| git pull | |
| touch tmp/restart.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment