Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include("ringo/subprocess");
- var log = require("ringo/logging").getLogger(module.id);
- exports.app = function(req) {
- log.info("Incoming request.");
- if (req.method !== "POST") {
- log.info("Not a valid POST request.");
- return {
- status: 400,
- headers: {"Content-Type": "text/plain"},
- body: ["Bad request!"]
- };
- }
- if (req.pathInfo !== "/github-update-somesupersecretURIsuffix") {
- log.info("Invalid update request. " + req.pathInfo);
- return {
- status: 403,
- headers: {"Content-Type": "text/plain"},
- body: ["Forbidden!"]
- };
- }
- var str = command("/path/to/scripts/github-pull.sh");
- log.info("Updated repository ==> " + str);
- return {
- status: 200,
- headers: {"Content-Type": "text/plain"},
- body: ["Done."]
- };
- };
- if (require.main == module)
- require("ringo/httpserver").main(module.id);
Add Comment
Please, Sign In to add comment