diff --git a/modules/project/pages.js b/modules/project/pages.js index 76bbe4b..7d964de 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -4,16 +4,26 @@ var exec = require('child_process').exec, var pages = function(dbot) { var quoteCat = dbot.db.quoteArrs[dbot.config.name], - rev, diff, branch; + rev, diff, branch, credit, authors = []; + exec("git log --format='%cN¬' | sort -u | tr -d '\n'", function (error, stdout, sderr) { + var credit = stdout.split("¬"); // nobody uses ¬, do they? + for (var i = 0; i < credit.length; i++) { + if ((credit[i].split(" ").length) == 2){ + console.log(credit[i]); + authors.push(credit[i]); + } + } + }); exec("git rev-list --all | wc -l", function(error, stdout, stderr) { - rev = stdout + 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 }); @@ -33,7 +43,10 @@ var pages = function(dbot) { } res.render('project', { - "configList": dbot.modules.project.api.configList(), // what variable do I put here + "configList": dbot.modules.project.api.configList(), + "authors": authors, //dbot.modules.project.api.getAuthors(), + "credits": dbot.t("credits"), + "thanks": dbot.t("thanks"), "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 ba256e1..48ed053 100644 --- a/modules/project/project.js +++ b/modules/project/project.js @@ -4,7 +4,8 @@ * the dbot. */ -_ = require('underscore'); +_ = require('underscore'), + exec = require('child_process').exec; var project = function(dbot) { @@ -16,7 +17,7 @@ var project = function(dbot) { "username": dbot.config.dent.username })); } - if(dbot.config.dent.dentQuotes) { + if(_.has(dbot.config.dent.dentQuotes)) { list.push(dbot.t("dent-push")); } if(_.has(dbot.modules,'link')){ @@ -40,10 +41,17 @@ var project = function(dbot) { })); } return list; + }, + 'getAuthors': function(callback) { + var foo = ['a','b','c']; + exec("git rev-list --all | wc -l", function(error, stdout, stderr){ + foo.push(stdout); + }); + callback(foo); } - }; -} - + } +} + exports.fetch = function(dbot){ return new project(dbot); } diff --git a/modules/project/strings.json b/modules/project/strings.json index a66b1d9..f3c80b5 100644 --- a/modules/project/strings.json +++ b/modules/project/strings.json @@ -9,6 +9,12 @@ "it": "{name} parla {lang} ({langen})", "nl": "{name} spreekt {lang} ({langen})" }, + "thanks": { + "en": "With thanks to:" + }, + "credits": { + "en": "Authors" + }, "pagetitle": { "en": "{botname} web interface", "fr": "{botname} interface réseau", diff --git a/public/project.css b/public/project.css index 0659a28..6b36846 100644 --- a/public/project.css +++ b/public/project.css @@ -59,6 +59,7 @@ ul { text-align:center; margin-left:0; margin-bottom:5px; + font-size:80%; } li { background-image: linear-gradient(to bottom, #f5ebe2, #f5e6d8); diff --git a/views/project/project.jade b/views/project/project.jade index 8dd2ee3..9f5e3cd 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -16,36 +16,43 @@ html(lang='#{curr839}') p.intro #{dquote} section#development - h3 #{development} - h4 #{git} - p.center - #{revnum} - ul - li #{branch} - pre#gitdiff - #{diff} - h4 #{milestonehead} - table#milestones.center - tr - th #{milestonename} - th #{milestoneprog} - th #{openmilestone} - th #{closedmilestone} - each milestone in milestones - - var width = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100) - tr(id="milestone"+milestone.number) - td - a(href="https://github.com/"+repo+"/issues?milestone="+milestone.number) - #{milestone.title} - td - div.progress(class=milestone.state) - div.progress-inner(style="width:"+width+"%")(class=milestone.state) -   - print #{Math.round(width)+"%"} - td #{milestone.open_issues} - td #{milestone.closed_issues} - p.center - a(href="https://github.com/"+repo) #{propaganda} + h3 #{development} + h4 #{git} + p.center + #{revnum} + ul + li #{branch} + pre#gitdiff + #{diff} + h4 #{milestonehead} + table#milestones.center + tr + th #{milestonename} + th #{milestoneprog} + th #{openmilestone} + th #{closedmilestone} + each milestone in milestones + - var width = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100) + tr(id="milestone"+milestone.number) + td + a(href="https://github.com/"+repo+"/issues?milestone="+milestone.number) + #{milestone.title} + td + div.progress(class=milestone.state) + div.progress-inner(style="width:"+width+"%")(class=milestone.state) +   + print #{Math.round(width)+"%"} + td #{milestone.open_issues} + td #{milestone.closed_issues} + p.center + a(href="https://github.com/"+repo) #{propaganda} + h4 + #{credits} + p.center + #{thanks} + ul#credits + each author in authors + li #{author} section#config h3 #{config} ul