Merge pull request #377 from zuzak/gitstatus

Gitstatus
This commit is contained in:
reality 2013-04-18 10:56:14 -07:00
commit b2e51060f3
8 changed files with 308 additions and 3 deletions

@ -1 +1 @@
Subproject commit e9e9089f282b0455a481460ebec17a4672617ceb Subproject commit 7e38c6be750a071724763872175f1a9445297b76

View File

@ -0,0 +1,4 @@
{
"quotecat":"depressionbot",
"dependencies": ["web", "quotes", "github"]
}

62
modules/project/pages.js Normal file
View File

@ -0,0 +1,62 @@
var exec = require('child_process').exec,
request = require('request');
var pages = function(dbot) {
var depression = dbot.db.quoteArrs[dbot.config.project.quotecat];
var rev;
exec("git rev-list --all | wc -l", function(a,b,c){rev = b});
var diff;
exec("git log -1", function(a, b, c){diff = b});
/* TODO: merge back into github module */
var milestones;
request("https://api.github.com/repos/" + dbot.config.github.defaultrepo + "/milestones?state=open", function(e, r, b){
milestones = JSON.parse(b);
});
return {
'/project': function(req, res) {
res.render('project', {
"name": dbot.config.name,
"intro": dbot.t("dbotintro", {
"botname": dbot.config.name
}),
"curr839": dbot.config.language,
"currver": dbot.config.version,
"currlang": dbot.t("dbotspeaks",{
"lang839": dbot.config.language,
"langen": dbot.strings[dbot.config.language]["en"],
"lang": dbot.t(dbot.config.language),
"name": dbot.config.name
}),
"projectstatus": dbot.t("projectstatus"),
"revnum": dbot.t("revnum",{
"name": dbot.config.name,
"rev": rev,
"ver": "abcdef" // TODO, obviously
}),
"modules": dbot.config.moduleNames,
"loadmod": dbot.t("loadedmodules"),
"debugmode": dbot.t("debugmode-" + dbot.config.debugMode),
"milestones": milestones,
"milestoneprog": dbot.t("milestoneprog"),
"config": dbot.t("configoptions"),
"milestonename": dbot.t("milestonename"),
"openmilestone": dbot.t("openmilestone"),
"closedmilestone": dbot.t("closedmilestone"),
"development": dbot.t("development"),
"dquote": depression[Math.floor(Math.random()*depression.length)],
"diff": diff,
"pagetitle": dbot.t("pagetitle", {
"botname": dbot.config.name
})
});
},
};
};
exports.fetch = function(dbot) {
return pages(dbot);
};

View File

@ -0,0 +1,14 @@
/**
* Module Name: imgur
* Description: Various imgur functionality
*/
var _ = require('underscore')._,
request = require('request');
var project = function(dbot) {
// nothing to see here go away love zuzak
}
exports.fetch = function(dbot) {
return new project(dbot);
}

View File

@ -0,0 +1,100 @@
{
"dbotintro": {
"en": "{botname} lorem ipsum dolor sit amet"
},
"dbotspeaks": {
"en": "{name} speaks {lang})",
"de": "{name} spricht {lang} ({langen})",
"fr": "{name} parle {lang} ({langen})",
"it": "{name} parla {lang} ({langen})"
},
"pagetitle": {
"en": "{botname} web interface",
"fr": "{botname} interface réseau",
"de": "{botname} Web-Interface",
"it": "{botname} interfaccia web"
},
"en": {
"en": "English",
"fr": "anglais",
"de": "Englisch",
"it": "inglese"
},
"fr": {
"en": "French",
"fr": "français",
"de": "Französisch",
"it": "francese"
},
"de": {
"en": "German",
"fr": "allemande",
"de": "Deutsch",
"it": "tedesco"
},
"it": {
"en": "Italian",
"fr": "italien",
"de": "Italienier",
"it": "italiano"
},
"revnum": {
"en": "{name} is at revision {rev}",
"fr": "{name} est à révision {rev}",
"de": "{name} ist in der Revision {rev}",
"it": "{name} il numero di revisione {rev}"
},
"loadedmodules": {
"en": "loaded modules",
"fr": "modules chargés",
"it": "moduli caricati"
},
"configoptions": {
"en": "Configuration",
"fr": "Configuration",
"de": "Konfiguration",
"it": "Configuazione"
},
"debugmode-true": {
"en": "Debug mode active",
"fr": "debug actif",
"de": "Debug aktiv",
"it": "debug attivo"
},
"debugmode-false": {
"en": "Debug off",
"fr": "debug éteint",
"de": "Debug ausgeschaltet",
"it": "debug spento"
},
"milestoneprog": {
"en": "Progress",
"fr": "Progression",
"de": "Fortschritt",
"it": "sviluppo"
},
"openmilestone": {
"en": "Open",
"fr": "Ouvert",
"de": "Offen",
"it": "Aperto"
},
"closedmilestone": {
"en": "Closed",
"fr": "Fermé",
"de": "Gesperrt",
"it": "Chiuso"
},
"milestonename": {
"en": "Name",
"fr": "Nom",
"de": "Name",
"it": "Nome"
},
"development": {
"en": "Development",
"fr": "Développement",
"de": "Entwicklung",
"it": "Sviluppo"
}
}

63
public/project.css Normal file
View File

@ -0,0 +1,63 @@
pre#gitdiff {
text-align:left;
width:80;
margin:auto;
}
div#main {
text-align:inherit;
font-size:18px;
}
h2,h3,h4,h5,h6,.center {
text-align:center;
}
table#milestones {
margin:auto;
width:80%;
}
table#milestones td {
padding:5px;
}
p.intro {
text-align:center;
border:1px solid #ccc;
padding:20px;
border-radius:4px;
}
div.progress.open {
background-image: linear-gradient(to bottom,#f4fff4,#f9fff9);
}
div.progress {
margin-top:auto;
margin-bottom:auto;
}
div.progress-inner.open {
width:20%;
background-image: linear-gradient(to bottom,#3fff3f,#7fff7f);
}
div.progress.closed {
background-image: linear-gradient(to bottom,#fff5f5,#fff9f9);
}
div.progress-inner.closed {
background-image: linear-gradient(to bottom,#ff3f3f,#ff7f7f);
width:20%;
}
#config {
text-align:center;
}
li {
background-image: linear-gradient(to bottom, #f5ebe2, #f5e6d8);
border:1px solid #f5dcc5;
padding:5px;
margin:5px;
display:inline-block;
}
* {
text-shadow:none;
}
#footer {
font-size:80%;
}

View File

@ -13,7 +13,6 @@ body {
margin: 0; margin: 0;
font-family: "Source Sans Pro", sans-serif; font-family: "Source Sans Pro", sans-serif;
color: #444; color: #444;
text-shadow: 1px 1px 2px #2B2B2B;
background: url("background.jpg") no-repeat center center fixed; background: url("background.jpg") no-repeat center center fixed;
-webkit-background-size: cover; -webkit-background-size: cover;
-moz-background-size: cover; -moz-background-size: cover;
@ -133,7 +132,6 @@ li.quote {
padding: 6px; padding: 6px;
font-size: 18px; font-size: 18px;
width: 40%; width: 40%;
text-shadow: 1px 1px 1px black;
} }
img { img {

View File

@ -0,0 +1,64 @@
!!!
html(lang='#{curr839}')
head
meta(charset='utf-8')
script(type="text/javascript", src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js")
link(rel="stylesheet", type="text/css", href="http://fonts.googleapis.com/css?family=Source+Sans+Pro")
link(rel="stylesheet", type="text/css", href="/bootstrap/css/bootstrap.min.css")
link(rel='stylesheet', type='text/css', href='/styles.css')
link(rel="stylesheet", href="/project.css")
title #{pagetitle}
- var mstone = "milestone"
style(type="text/css")
each milestone in milestones
- current = mstone+milestone.number
- wdth = ((milestone.open_issues/(milestone.open_issues + milestone.closed_issues))*100)
.current { width: wdth% }
body
div.container
div#page
div#title #{pagetitle}
div.container#main
p.intro
#{dquote}
section#git
h3 #{development}
p.center
#{revnum}
pre#gitdiff
#{diff}
h4 #{milestoneprog}
table#milestones.center
tr
th #{milestonename}
th #{milestoneprog}
th #{openmilestone}
th #{closedmilestone}
each milestone in milestones
- var mstone = "milestone"
- var wd = "width:"
- var pc = "%"
- var wdth = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100)
tr(id=mstone+milestone.number)
td #{milestone.title}
td
div.progress(class=milestone.state)
div.progress-inner(style=wd+wdth+pc)(class=milestone.state)
 
td #{milestone.open_issues}
td #{milestone.closed_issues}
section#config
h3 #{config}
ul
li #{currlang}
li #{debugmode}
h4 #{loadmod}
ul#modules
each module in modules
li #{module}
section#footer
p
#{currver}
script(type="text/javascript", src="/bootstrap/js/bootstrap.min.js")
script(type="text/javascript", src="/d3/d3.v3.min.js")
script(type="text/javascript", src="/script.js")