Skip to content

Commit

Permalink
added history module
Browse files Browse the repository at this point in the history
  • Loading branch information
stbaer committed Jan 7, 2017
1 parent 4493051 commit 13bb138
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/history.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const shellEx = require('../lib/ex').shellEx;
const handleError = require('./handle-error');

const getDate = () => {
const d = new Date();

const months = ['January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'];

return `${months[d.getMonth()]} ${d.getDate()}, ${d.getFullYear()}`;
};

module.exports = (currentVersion, newVersion) => {
const logCommand = shellEx(`git log ${currentVersion}..HEAD --pretty=format:" * %s"`);
const date = getDate();

if (logCommand.code !== 0) {
handleError(logCommand.stderr);
}

return `###${newVersion} — *${date}*\n\n${logCommand.stdout}\n`;
};

0 comments on commit 13bb138

Please sign in to comment.