From d4320bbde78ccf179d21df42428144cf169f473b Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 17:56:38 +0000 Subject: [PATCH] greload command to git pull then reload --- modules/admin.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/admin.js b/modules/admin.js index 70be12b..6395fb5 100644 --- a/modules/admin.js +++ b/modules/admin.js @@ -1,4 +1,6 @@ var fs = require('fs'); +var sys = require('sys') +var exec = require('child_process').exec; var adminCommands = function(dbot) { var dbot = dbot; @@ -17,6 +19,15 @@ var adminCommands = function(dbot) { dbot.instance.part(params[1]); }, + // Do a git pull and reload + 'greload': function(data, params) { + var child; + + child = exec("cd ../ && git pull", function (error, stdout, stderr) { + commands.reload(data, params); + }.bind(this)); + }, + 'reload': function(data, params) { dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8')); dbot.reloadModules();