Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit fb64eb96b6b55f4b4c6dd79b2d22f7f070e6d895 @theycallmeswift committed Oct 21, 2012
Showing with 55 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +22 −0 package.json
  3. +28 −0 server.js
@@ -0,0 +1,5 @@
+node_modules/
+*.sw[a-z]
+*.orig
+.DS_Store
+*.working
@@ -0,0 +1,22 @@
+{
+ "name": "testuino",
+ "version": "0.0.0",
+ "description": "A buildbot for arduino and github",
+ "main": "server.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": "",
+ "keywords": [
+ "Arduino",
+ "Testing",
+ "Build",
+ "Bot"
+ ],
+ "author": "Swift <theycallmeswift@gmail.com>",
+ "license": "Beerware",
+ "dependencies": {
+ "express": "~3.0.0rc5",
+ "johnny-five": "~0.5.14"
+ }
+}
@@ -0,0 +1,28 @@
+var util = require('util')
+ , express = require('express')
+ , app = express()
+ , port = process.env.PORT || 3000;
+
+app.configure(function() {
+ app.use(express.bodyParser());
+});
+
+app.post('/github', function(req, res) {
+ if(!req.body.payload) {
+ util.log("Malformed request: " + JSON.stringify(req.body));
+ res.statusCode = 400;
+ return res.send("ERROR");
+ }
+
+ var payload = JSON.parse(req.body.payload)
+ , url = payload.repository.url
+ , lastCommit = payload.commits[0];
+
+ util.log("Testing commit by " + lastCommit.author.name + " for " + url);
+
+ res.send("OK");
+});
+
+app.listen(port, function() {
+ console.log("Listening on port " + port);
+});

0 comments on commit fb64eb9

Please sign in to comment.