From 7caa659017d987835dbc8dd264d282c8022bb210 Mon Sep 17 00:00:00 2001 From: Sam Nicholls Date: Sat, 5 Jan 2013 22:04:59 +0000 Subject: [PATCH 1/3] version command [Close #96] --- modules/admin/admin.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/admin/admin.js b/modules/admin/admin.js index 83eab08..ac2e7e6 100644 --- a/modules/admin/admin.js +++ b/modules/admin/admin.js @@ -50,6 +50,34 @@ var admin = function(dbot) { commands.reload(event); }.bind(this)); }.bind(this)); + + event.message = 'version'; + event.action = 'PRIVMSG'; + event.params = event.message.split(' '); + dbot.instance.emit(event); + }, + + // Display commit information for part of dbot + 'version': function(event){ + var cmd = "git log --pretty=format:'%h (%s): %ar' -n 1 -- "; + if(event.params[1]){ + var input = event.params[1].trim(); + if(dbot.modules.hasOwnProperty(input.split("/")[0])){ + cmd += "modules/"+input; + } + else{ + cmd += input; + } + } + + exec(cmd, function(error, stdout, stderr){ + if(stdout.length > 0){ + event.reply(stdout); + } + else{ + event.reply("No version information or queried module not loaded"); + } + }.bind(this)); }, // Reload DB, translations and modules. From ddc538b6a07aa88813c4b664ffbb4761a4eb000c Mon Sep 17 00:00:00 2001 From: Sam Nicholls Date: Sat, 5 Jan 2013 22:20:09 +0000 Subject: [PATCH 2/3] Report version after greload callbacks complete --- modules/admin/admin.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/admin/admin.js b/modules/admin/admin.js index ac2e7e6..962eda0 100644 --- a/modules/admin/admin.js +++ b/modules/admin/admin.js @@ -48,13 +48,12 @@ var admin = function(dbot) { exec("git submodule update", function (error, stdout, stderr) { event.reply(dbot.t('gpull')); commands.reload(event); + event.message = 'version'; + event.action = 'PRIVMSG'; + event.params = event.message.split(' '); + dbot.instance.emit(event); }.bind(this)); }.bind(this)); - - event.message = 'version'; - event.action = 'PRIVMSG'; - event.params = event.message.split(' '); - dbot.instance.emit(event); }, // Display commit information for part of dbot From 94a28e29f1d674038aa86cadba1f8bc582f44555 Mon Sep 17 00:00:00 2001 From: Sam Nicholls Date: Sun, 6 Jan 2013 13:32:48 +0000 Subject: [PATCH 3/3] Update stats --- modules/stats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/stats b/modules/stats index b8a3724..0c9e207 160000 --- a/modules/stats +++ b/modules/stats @@ -1 +1 @@ -Subproject commit b8a3724739bdf8d9d7b53839b36bfb742f48d281 +Subproject commit 0c9e207dd2f6dc6a65efef82bc48dd68d7a9fb18