Created
March 19, 2013 18:37
-
-
Save mattneary/5198857 to your computer and use it in GitHub Desktop.
Github Service Hook
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
var http = require('http'); | |
var exec = require('child_process').exec; | |
var repo = "https://github.com/mattneary/Watterson-Dresses.git"; | |
http.createServer(function(req, res) { | |
exec("rm -rf /home/ec2-user/sites/Watterson-Dresses", function(err, stdout, stderr) { | |
if( err ) { | |
res.writeHead(400); | |
res.end("error: "+JSON.stringify(err)) | |
return; | |
} | |
exec("git clone "+repo, function(err, stdout, stderr) { | |
if( err ) { | |
res.writeHead(400); | |
res.end("error: "+JSON.stringify(err)); | |
} | |
res.end(JSON.stringify([stdout, stderr])); | |
}); | |
}); | |
}).listen(8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment