Skip to content

Commit

Permalink
Updated changelog generation
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Aug 18, 2015
1 parent f656174 commit b9c13fb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions build/changelog.js
Expand Up @@ -3,26 +3,26 @@ var gulp = require('gulp'),
git = require('gulp-git'),
replace = require('gulp-replace'),
path = require('path');

var repo = require('../package.json').repository.url;

gulp.task('changelog', function(done) {
git.exec({ args: 'log --oneline --decorate' }, function(err, stdout) {
if(err) return done(err);
return done(null, gulp.src('CHANGELOG.md')
.pipe(replace(/.|\n/g, ''))
.pipe(replace(/$/, stdout))
.pipe(replace(/#(\d+)/, '[#$1](' + repo + '/issues/$1)'))
.pipe(replace(/([a-f0-9]{7}) \(HEAD[^)]*\) (.+)/g, function(_, sha, comment) {
return '\n## [Working Changes](' + repo + ')' +
'\n- [' + sha + '](' + repo + '/commit/' + sha + ') ' + comment;
}))
.pipe(replace(/([a-f0-9]{7}) \(tag: ([^\s),]*)[^)]*\) (.+)/g, function(_, sha, tag, comment) {
.pipe(replace(/([a-f0-9]{7}) \((?:HEAD, )?tag: ([^\s),]*)[^)]*\) (.+)/g, function(_, sha, tag, comment) {
var niceTag = tag;
if(tag.indexOf('v') !== 0) niceTag = 'v' + tag;
return '\n## [' + niceTag + '](' + repo + '/tree/' + tag + ')' +
'\n- [' + sha + '](' + repo + '/commit/' + sha + ') ' + comment;
}))
.pipe(replace(/([a-f0-9]{7}) \(HEAD[^)]*\) (.+)/g, function(_, sha, comment) {
return '\n## [Working Changes](' + repo + ')' +
'\n- [' + sha + '](' + repo + '/commit/' + sha + ') ' + comment;
}))
.pipe(replace(/([a-f0-9]{7}) (.+)/g, '- [$1](' + repo + '/commit/$1) $2'))
.pipe(gulp.dest('.')));
});
Expand Down

0 comments on commit b9c13fb

Please sign in to comment.