From adcd5803b06229289f610f5871659e7dcaa7e6cb Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Sat, 20 Apr 2013 17:42:34 +0000 Subject: [PATCH] move some stuff to project.js --- modules/project/pages.js | 40 +++++---------------------------- modules/project/project.js | 45 ++++++++++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/modules/project/pages.js b/modules/project/pages.js index 87dcad4..1412471 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -9,45 +9,15 @@ var pages = function(dbot) { exec("git rev-list --all | wc -l", function(error, stdout, stderr) { rev = stdout }); + exec("git rev-parse --abbrev-ref HEAD", function(error, stdout, stderr) { branch = stdout }); + exec("git log -1", function(error, stdout, stderr) { diff = stdout - }); - var configList = []; - if(_.has(dbot.modules,'dent')){ - configList.push(dbot.t("dent-account", { - "username": dbot.config.dent.username - })); - if(dbot.config.dent.dentQuotes) { - configList.push(dbot.t("dent-push")); - } - } - if(_.has(dbot.modules,'link')){ - if(dbot.config.link.autoTitle){ - configList.push(dbot.t("link-autotitle")); - } - } - if(_.has(dbot.modules,'quotes')){ - configList.push(dbot.t("quote-rmlimit", { - "limit": dbot.config.quotes.rmLimit - })); - } - if(_.has(dbot.modules,'report')){ - if(dbot.config.report.notifyVoice){ - configList.push(dbot.t("report-notifyvoice")); - } - } - if(_.has(dbot.modules,'web')){ - configList.push(dbot.t("web-port", { - "port": dbot.config.web.webPort - })); - } - - - - + }); + /* TODO: merge back into github module */ var milestones; request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(error, response, body){ @@ -63,7 +33,7 @@ var pages = function(dbot) { } res.render('project', { - "configList": configList, + "configList": "", // what variable do I put here "name": dbot.config.name, "intro": dbot.t("dbotintro", { "botname": dbot.config.name diff --git a/modules/project/project.js b/modules/project/project.js index 25e3e35..302b504 100644 --- a/modules/project/project.js +++ b/modules/project/project.js @@ -4,10 +4,47 @@ * the dbot. */ -var project = function(dbot) { - // Nothing to see here go away love zuzak -} +_ = require('underscore'), + exec = require('child_process').exec; -exports.fetch = function(dbot) { +var project = function(dbot) { + + this.onLoad = function() { + var configList = function(){ + var list = []; + if(_.has(dbot.modules,'dent')){ + configList.push(dbot.t("dent-account", { + "username": dbot.config.dent.username + })); + } + if(dbot.config.dent.dentQuotes) { + configList.push(dbot.t("dent-push")); + } + if(_.has(dbot.modules,'link')){ + if(dbot.config.link.autoTitle){ + configList.push(dbot.t("link-autotitle")); + } + } + if(_.has(dbot.modules,'quotes')){ + configList.push(dbot.t("quote-rmlimit", { + "limit": dbot.config.quotes.rmLimit + })); + } + if(_.has(dbot.modules,'report')){ + if(dbot.config.report.notifyVoice){ + configList.push(dbot.t("report-notifyvoice")); + } + } + if(_.has(dbot.modules,'web')){ + configList.push(dbot.t("web-port", { + "port": dbot.config.web.webPort + })); + } + return list; + }.bind(this); + }.bind(this); +} + +exports.fetch = function(dbot){ return new project(dbot); }