forked from GitHub/dbot
Merge git://github.com/reality/depressionbot into database
This commit is contained in:
commit
c5fb52a4a7
@ -1,21 +1,37 @@
|
|||||||
var exec = require('child_process').exec,
|
var exec = require('child_process').exec,
|
||||||
request = require('request');
|
request = require('request'),
|
||||||
|
_ = require('underscore');
|
||||||
|
|
||||||
var pages = function(dbot) {
|
var pages = function(dbot) {
|
||||||
var quoteCat = dbot.db.quoteArrs[dbot.config.name],
|
var quoteCat = dbot.db.quoteArrs[dbot.config.name],
|
||||||
rev, diff;
|
rev, diff, branch, credit, authors = [];
|
||||||
|
exec("git log --format='%cN¬' | sort -u | tr -d '\n'", function (error, stdout, sderr) {
|
||||||
exec("git rev-list --all | wc -l", function(a, b, c) {
|
var credit = stdout.split("¬"); // nobody uses ¬, do they?
|
||||||
rev = b
|
for (var i = 0; i < credit.length; i++) {
|
||||||
|
if ((credit[i].split(" ").length) == 2){
|
||||||
|
console.log(credit[i]);
|
||||||
|
authors.push(credit[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
exec("git log -1", function(a, b, c) {
|
|
||||||
diff = b
|
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
|
||||||
});
|
});
|
||||||
|
|
||||||
/* TODO: merge back into github module */
|
/* TODO: merge back into github module */
|
||||||
var milestones;
|
var milestones;
|
||||||
request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(e, r, b){
|
request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(error, response, body){
|
||||||
milestones = JSON.parse(b);
|
milestones = JSON.parse(body);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -27,11 +43,20 @@ var pages = function(dbot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.render('project', {
|
res.render('project', {
|
||||||
|
"translation": dbot.modules.project.api.translationProgress(),
|
||||||
|
"configList": dbot.modules.project.api.configList(),
|
||||||
|
"authors": authors,
|
||||||
|
"credits": dbot.t("credits"),
|
||||||
|
"thanks": dbot.t("thanks"),
|
||||||
"name": dbot.config.name,
|
"name": dbot.config.name,
|
||||||
"intro": dbot.t("dbotintro", {
|
"intro": dbot.t("dbotintro", {
|
||||||
"botname": dbot.config.name
|
"botname": dbot.config.name
|
||||||
}),
|
}),
|
||||||
"curr839": dbot.config.language,
|
"curr839": dbot.config.language,
|
||||||
|
"repo": dbot.config.github.defaultrepo,
|
||||||
|
"branch": dbot.t("branch",{
|
||||||
|
"branch": branch
|
||||||
|
}),
|
||||||
"currver": dbot.config.version,
|
"currver": dbot.config.version,
|
||||||
"currlang": dbot.t("dbotspeaks",{
|
"currlang": dbot.t("dbotspeaks",{
|
||||||
"lang839": dbot.config.language,
|
"lang839": dbot.config.language,
|
||||||
@ -42,8 +67,7 @@ var pages = function(dbot) {
|
|||||||
"projectstatus": dbot.t("projectstatus"),
|
"projectstatus": dbot.t("projectstatus"),
|
||||||
"revnum": dbot.t("revnum",{
|
"revnum": dbot.t("revnum",{
|
||||||
"name": dbot.config.name,
|
"name": dbot.config.name,
|
||||||
"rev": rev,
|
"rev": rev
|
||||||
"ver": "abcdef" // TODO, obviously
|
|
||||||
}),
|
}),
|
||||||
"modules": dbot.config.moduleNames,
|
"modules": dbot.config.moduleNames,
|
||||||
"loadmod": dbot.t("loadedmodules"),
|
"loadmod": dbot.t("loadedmodules"),
|
||||||
@ -59,7 +83,16 @@ var pages = function(dbot) {
|
|||||||
"diff": diff,
|
"diff": diff,
|
||||||
"pagetitle": dbot.t("pagetitle", {
|
"pagetitle": dbot.t("pagetitle", {
|
||||||
"botname": dbot.config.name
|
"botname": dbot.config.name
|
||||||
})
|
}),
|
||||||
|
"git": dbot.t("git"),
|
||||||
|
"milestonehead": dbot.t("milestones"),
|
||||||
|
"propaganda": dbot.t("propaganda"),
|
||||||
|
"languagecurr": dbot.t(dbot.config.language),
|
||||||
|
"languagenati": dbot.t("langhead-native"),
|
||||||
|
"languageeng": dbot.t("en"),
|
||||||
|
"languageprog": dbot.t("langhead-progress"),
|
||||||
|
"languagetrans": dbot.t("langhead-translations"),
|
||||||
|
"languagetranshead": dbot.t("translations")
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -4,10 +4,74 @@
|
|||||||
* the dbot.
|
* the dbot.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var project = function(dbot) {
|
_ = require('underscore'),
|
||||||
// Nothing to see here go away love zuzak
|
exec = require('child_process').exec;
|
||||||
}
|
|
||||||
|
|
||||||
exports.fetch = function(dbot) {
|
var project = function(dbot) {
|
||||||
|
|
||||||
|
this.api = {
|
||||||
|
'configList' : function(callback){
|
||||||
|
var list = [];
|
||||||
|
if(_.has(dbot.modules,'dent')){
|
||||||
|
list.push(dbot.t("dent-account", {
|
||||||
|
"username": dbot.config.dent.username
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if(_.has(dbot.config.dent.dentQuotes)) {
|
||||||
|
list.push(dbot.t("dent-push"));
|
||||||
|
}
|
||||||
|
if(_.has(dbot.modules,'link')){
|
||||||
|
if(dbot.config.link.autoTitle){
|
||||||
|
list.push(dbot.t("link-autotitle"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(_.has(dbot.modules,'quotes')){
|
||||||
|
list.push(dbot.t("quote-rmlimit", {
|
||||||
|
"limit": dbot.config.quotes.rmLimit
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if(_.has(dbot.modules,'report')){
|
||||||
|
if(dbot.config.report.notifyVoice){
|
||||||
|
list.push(dbot.t("report-notifyvoice"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(_.has(dbot.modules,'web')){
|
||||||
|
list.push(dbot.t("web-port", {
|
||||||
|
"port": dbot.config.web.webPort
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
},
|
||||||
|
'translationProgress' : function(callback){
|
||||||
|
var translation = [] ;
|
||||||
|
var str = _.values(dbot.strings);
|
||||||
|
for (var i = 0; i < str.length; i++){
|
||||||
|
var cur = _.keys(str[i]);
|
||||||
|
for (var j = 0; j < cur.length; j++) {
|
||||||
|
translation = translation.concat(cur[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var t = {};
|
||||||
|
for (var k = 0; k < translation.length; k++) {
|
||||||
|
var curr = translation[k];
|
||||||
|
if (t[curr]) {
|
||||||
|
t[curr]["count"] += 1;
|
||||||
|
} else {
|
||||||
|
t[curr] = {};
|
||||||
|
t[curr]["iso"] = curr;
|
||||||
|
t[curr]["count"] = 1;
|
||||||
|
t[curr]["own"] = dbot.strings[curr][curr];
|
||||||
|
t[curr]["local"] = dbot.t(curr);
|
||||||
|
t[curr]["english"] = dbot.strings[curr]["en"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(t);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.api['translationProgress'].external = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.fetch = function(dbot){
|
||||||
return new project(dbot);
|
return new project(dbot);
|
||||||
}
|
};
|
||||||
|
@ -9,11 +9,17 @@
|
|||||||
"it": "{name} parla {lang} ({langen})",
|
"it": "{name} parla {lang} ({langen})",
|
||||||
"nl": "{name} spreekt {lang} ({langen})"
|
"nl": "{name} spreekt {lang} ({langen})"
|
||||||
},
|
},
|
||||||
|
"thanks": {
|
||||||
|
"en": "With thanks to:"
|
||||||
|
},
|
||||||
|
"credits": {
|
||||||
|
"en": "Authors"
|
||||||
|
},
|
||||||
"pagetitle": {
|
"pagetitle": {
|
||||||
"en": "{botname} web interface",
|
"en": "{botname} web interface",
|
||||||
"fr": "{botname} interface réseau",
|
"fr": "{botname} interface réseau",
|
||||||
"de": "{botname} Web-Interface",
|
"de": "{botname} Web-Interface",
|
||||||
"it": "{botname} interfaccia web",
|
"it": "{botname} interfaccia web"
|
||||||
},
|
},
|
||||||
"en": {
|
"en": {
|
||||||
"en": "English",
|
"en": "English",
|
||||||
@ -57,14 +63,21 @@
|
|||||||
"fr": "na'vi",
|
"fr": "na'vi",
|
||||||
"de": "Na'vi",
|
"de": "Na'vi",
|
||||||
"it": "Na'vi",
|
"it": "Na'vi",
|
||||||
"nl": "Na'vi"
|
"nl": "Na'vi",
|
||||||
|
"na'vi": "Na'vi"
|
||||||
|
|
||||||
},
|
},
|
||||||
"es": {
|
"es": {
|
||||||
"en": "Spanish",
|
"en": "Spanish",
|
||||||
"fr": "espagnole",
|
"fr": "espagnole",
|
||||||
"de": "Spanisch",
|
"de": "Spanisch",
|
||||||
"it": "spagnolo",
|
"it": "spagnolo",
|
||||||
"nl": "Spaans"
|
"nl": "Spaans",
|
||||||
|
"es": "Español"
|
||||||
|
},
|
||||||
|
"nl": {
|
||||||
|
"en": "Dutch",
|
||||||
|
"nl": "Nederlands"
|
||||||
},
|
},
|
||||||
"revnum": {
|
"revnum": {
|
||||||
"en": "{name} is at revision {rev}",
|
"en": "{name} is at revision {rev}",
|
||||||
@ -100,6 +113,9 @@
|
|||||||
"it": "debug spento",
|
"it": "debug spento",
|
||||||
"nl": "Debug uitgeschakeld"
|
"nl": "Debug uitgeschakeld"
|
||||||
},
|
},
|
||||||
|
"milestones": {
|
||||||
|
"en": "Milestones"
|
||||||
|
},
|
||||||
"milestoneprog": {
|
"milestoneprog": {
|
||||||
"en": "Progress",
|
"en": "Progress",
|
||||||
"fr": "Progression",
|
"fr": "Progression",
|
||||||
@ -134,5 +150,44 @@
|
|||||||
"de": "Entwicklung",
|
"de": "Entwicklung",
|
||||||
"it": "Sviluppo",
|
"it": "Sviluppo",
|
||||||
"nl": "Ontwikkeling"
|
"nl": "Ontwikkeling"
|
||||||
|
},
|
||||||
|
"dent-account": {
|
||||||
|
"en": "Submitting dents to @{username}"
|
||||||
|
},
|
||||||
|
"dent-push": {
|
||||||
|
"en": "Pushing quotes to identi.ca"
|
||||||
|
},
|
||||||
|
"quote-rmlimit": {
|
||||||
|
"en": "Quote removal throttle set to {limit}"
|
||||||
|
},
|
||||||
|
"report-notifyvoice": {
|
||||||
|
"en": "Voiced users are being notified of reports"
|
||||||
|
},
|
||||||
|
"web-port": {
|
||||||
|
"en": "Web is listening on {port}"
|
||||||
|
},
|
||||||
|
"propaganda": {
|
||||||
|
"en": "Contribute to the code on Github!"
|
||||||
|
},
|
||||||
|
"branch": {
|
||||||
|
"en": "{branch}"
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"en": "version control"
|
||||||
|
},
|
||||||
|
"langhead-current": {
|
||||||
|
"en": "Current"
|
||||||
|
},
|
||||||
|
"langhead-translations": {
|
||||||
|
"en": "Completion"
|
||||||
|
},
|
||||||
|
"translations": {
|
||||||
|
"en": "Translations"
|
||||||
|
},
|
||||||
|
"langhead-progress": {
|
||||||
|
"en": "Translation Progress"
|
||||||
|
},
|
||||||
|
"langhead-native": {
|
||||||
|
"en": "Native"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,24 +2,20 @@ pre#gitdiff {
|
|||||||
text-align:left;
|
text-align:left;
|
||||||
width:80;
|
width:80;
|
||||||
margin:auto;
|
margin:auto;
|
||||||
|
text-transform:none;
|
||||||
}
|
}
|
||||||
div#main {
|
div#main {
|
||||||
text-align:inherit;
|
|
||||||
font-size:18px;
|
font-size:18px;
|
||||||
}
|
|
||||||
h2,h3,h4,h5,h6,.center {
|
|
||||||
text-align:center;
|
|
||||||
text-transform:lowercase;
|
text-transform:lowercase;
|
||||||
}
|
}
|
||||||
table#milestones {
|
table {
|
||||||
margin:auto;
|
margin:auto;
|
||||||
width:80%;
|
width:80%;
|
||||||
}
|
}
|
||||||
table#milestones td {
|
table td {
|
||||||
padding:5px;
|
padding:5px;
|
||||||
}
|
}
|
||||||
p.intro {
|
p.intro {
|
||||||
text-align:center;
|
|
||||||
border:1px solid #ccc;
|
border:1px solid #ccc;
|
||||||
padding:20px;
|
padding:20px;
|
||||||
border-radius:4px;
|
border-radius:4px;
|
||||||
@ -31,11 +27,16 @@ div.progress.open {
|
|||||||
div.progress {
|
div.progress {
|
||||||
margin-top:auto;
|
margin-top:auto;
|
||||||
margin-bottom:auto;
|
margin-bottom:auto;
|
||||||
|
text-align:left;
|
||||||
|
font-size:50%;
|
||||||
|
color:gray;
|
||||||
|
min-width:200px;
|
||||||
}
|
}
|
||||||
div.progress-inner.open {
|
div.progress-inner.open {
|
||||||
width:20%;
|
|
||||||
background-color: #3fff3f;
|
background-color: #3fff3f;
|
||||||
background-image: linear-gradient(to bottom,#3fff3f,#7fff7f);
|
background-image: linear-gradient(to bottom,#3fff3f,#7fff7f);
|
||||||
|
float:left;
|
||||||
|
margin-right:2px;
|
||||||
}
|
}
|
||||||
div.progress.closed {
|
div.progress.closed {
|
||||||
background-color: #fff5f5;
|
background-color: #fff5f5;
|
||||||
@ -44,14 +45,13 @@ div.progress.closed {
|
|||||||
div.progress-inner.closed {
|
div.progress-inner.closed {
|
||||||
background-color: #ff3f3f;
|
background-color: #ff3f3f;
|
||||||
background-image: linear-gradient(to bottom,#ff3f3f,#ff7f7f);
|
background-image: linear-gradient(to bottom,#ff3f3f,#ff7f7f);
|
||||||
width:20%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#config {
|
ul {
|
||||||
text-align:center;
|
margin-left:0;
|
||||||
text-transform:lowercase;
|
margin-bottom:5px;
|
||||||
|
font-size:80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
li {
|
li {
|
||||||
background-image: linear-gradient(to bottom, #f5ebe2, #f5e6d8);
|
background-image: linear-gradient(to bottom, #f5ebe2, #f5e6d8);
|
||||||
border:1px solid #f5dcc5;
|
border:1px solid #f5dcc5;
|
||||||
|
@ -44,7 +44,7 @@ div#backlink {
|
|||||||
div#title {
|
div#title {
|
||||||
font-size: 42px;
|
font-size: 42px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin: 0 0 10px 0;
|
margin: 0 0 10px 10px;
|
||||||
color: #444;
|
color: #444;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,33 +22,65 @@ html(lang='#{curr839}')
|
|||||||
p.intro
|
p.intro
|
||||||
#{dquote}
|
#{dquote}
|
||||||
section#git
|
section#git
|
||||||
h3 #{development}
|
h3 #{development}
|
||||||
p.center
|
p.center
|
||||||
#{revnum}
|
#{revnum}
|
||||||
pre#gitdiff
|
pre#gitdiff
|
||||||
#{diff}
|
#{diff}
|
||||||
h4 #{milestoneprog}
|
h4 #{milestoneprog}
|
||||||
table#milestones.center
|
table#milestones.center
|
||||||
tr
|
tr
|
||||||
th #{milestonename}
|
th #{milestonename}
|
||||||
th #{milestoneprog}
|
th #{milestoneprog}
|
||||||
th #{openmilestone}
|
th #{openmilestone}
|
||||||
th #{closedmilestone}
|
th #{closedmilestone}
|
||||||
each milestone in milestones
|
each milestone in milestones
|
||||||
- var mstone = "milestone"
|
- var wdth = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100)
|
||||||
- var wd = "width:"
|
tr(id=mstone+milestone.number)
|
||||||
- var pc = "%"
|
td
|
||||||
- var wdth = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100)
|
a(href=milestone.url)
|
||||||
tr(id=mstone+milestone.number)
|
#{milestone.title}
|
||||||
td
|
td
|
||||||
a(href=milestone.url)
|
div.progress(class=milestone.state)
|
||||||
#{milestone.title}
|
div.progress-inner(style="width:"+wdth+"%")(class=milestone.state)
|
||||||
td
|
|
||||||
div.progress(class=milestone.state)
|
print #{Math.round(wdth)+"%"}
|
||||||
div.progress-inner(style=wd+wdth+pc)(class=milestone.state)
|
td #{milestone.open_issues}
|
||||||
|
td #{milestone.closed_issues}
|
||||||
td #{milestone.open_issues}
|
h4 #{languagetranshead}
|
||||||
td #{milestone.closed_issues}
|
table
|
||||||
|
tr
|
||||||
|
th #{languagecurr}
|
||||||
|
th #{languagenati}
|
||||||
|
unless (curr839 == "en")
|
||||||
|
th #{languageeng}
|
||||||
|
th #{languageprog}
|
||||||
|
th #{languagetrans}
|
||||||
|
each language in translation
|
||||||
|
- var w = ((language.count/translation.en.count)*100)
|
||||||
|
tr
|
||||||
|
td #{language.local}
|
||||||
|
td #{language.own}
|
||||||
|
unless (curr839 == "en")
|
||||||
|
td #{language.english}
|
||||||
|
td.prog
|
||||||
|
unless (language.iso == curr839)
|
||||||
|
div.progress(class="open")
|
||||||
|
div.progress-inner(style="width:"+w+"%")(class="open")
|
||||||
|
|
||||||
|
print #{Math.round(w)+"%"}
|
||||||
|
else
|
||||||
|
div.progress(class="closed")
|
||||||
|
div.progress-inner(style="width:"+w+"%")(class="closed")
|
||||||
|
|
||||||
|
print #{Math.round(w)+"%"}
|
||||||
|
td #{language.count} / #{translation.en.count}
|
||||||
|
h4 #{credits}
|
||||||
|
#{thanks}
|
||||||
|
ul
|
||||||
|
each author in authors
|
||||||
|
li
|
||||||
|
#{author}
|
||||||
section#config
|
section#config
|
||||||
h3 #{config}
|
h3 #{config}
|
||||||
ul
|
ul
|
||||||
|
Loading…
Reference in New Issue
Block a user