Skip to content

Commit

Permalink
Add a combined spec log
Browse files Browse the repository at this point in the history
To quickly look for interesting things that have happened.
  • Loading branch information
foolip committed Jan 4, 2018
1 parent 7a2623a commit 4bffa6f
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
10 changes: 10 additions & 0 deletions static/speclog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<meta charset=utf-8>
<title>day-to-day speclog</title>
<style>
li {
list-style-type: none;
}
</style>
<body>
<script src="speclog.js"></script>
60 changes: 60 additions & 0 deletions static/speclog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
'use strict';

function commitFromLine(line) {
const parts = line.split(' ');
return {
date: parts[0],
hash: parts[1],
subject: parts.splice(2).join(' ')
};
}

function main() {
fetch('data.json')
.then(response => response.json())
.then(data => {
let order = 0;
const commits = [];

for (const entry of data.specs) {
for (const line of entry.speclog) {
const commit = commitFromLine(line);
commits.push({
order: order++,
date: commit.date,
subject: commit.subject,
name: entry.name,
url: `https://github.com/${entry.specrepo}/commit/${commit.hash}`,
});
}
}

commits.sort((a, b) => {
if (a.date < b.date)
return 1;
if (a.date > b.date)
return -1;
if (a.order < b.order)
return -1;
if (a.order > b.order)
return 1;
return 0;
});

const list = document.createElement('ol');

for (const commit of commits) {
const listItem = document.createElement('li');
listItem.textContent = `${commit.date}: ${commit.name}: `;
const link = document.createElement('a');
link.href = commit.url;
link.textContent = commit.subject;
listItem.appendChild(link);
list.appendChild(listItem);
}

document.body.appendChild(list);
});
}

main();

0 comments on commit 4bffa6f

Please sign in to comment.