Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
labels filter in changelog task
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalets committed Aug 17, 2012
1 parent 42cf458 commit 30aaf57
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
12 changes: 11 additions & 1 deletion grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module.exports = function(grunt) {
changelog: {
user: 'vitalets',
repo: 'bootstrap-editable'
//labels: ['enhancement']
},
min: {
dist: {
Expand Down Expand Up @@ -97,7 +98,16 @@ module.exports = function(grunt) {
basePath: "dist"
},
files: {
"<%= dist %>/bootstrap-editable-v<%= pkg.version %>.zip": "<%= dist %>/**"
"<%= dist %>/bootstrap-editable-v<%= pkg.version %>.zip": ["<%= dist_source %>/**", "<%= dist %>/libs/**"]
}
},
tgz: {
options: {
mode: "tgz",
basePath: "dist"
},
files: {
"<%= dist %>/bootstrap-editable-v<%= pkg.version %>.tar.gz": ["<%= dist_source %>/**", "<%= dist %>/libs/**"]
}
}
},
Expand Down
21 changes: 17 additions & 4 deletions tasks/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ module.exports = function(grunt) {
var options = grunt.config(this.name);

if(!options.dest) options.dest = 'CHANGELOG';
if(!options.labels) options.labels = ['bug', 'enhancement'];

console.log('Labels: ' + options.labels);

var GitHubApi = require("github");
var github = new GitHubApi({
Expand Down Expand Up @@ -39,11 +42,22 @@ module.exports = function(grunt) {
lines.push("\r\n");
lines.push('Version '+ms.title + (ms.due_on ? ' '+moment(ms.due_on).format('MMM D, YYYY') : ''));
lines.push('----------------------------');


var issueLines = [];
ms.issues.forEach(function(issue) {
issue.labels.forEach(function(e, i, arr) {arr[i] = e.name});
lines.push('['+issue.labels.join(',') + '] #'+issue.number+': '+issue.title+' (' + (issue.assignee ? ('@'+issue.assignee.login) : '') + ')');
var labels = [];
issue.labels.forEach(function(e, i, arr) {
if(options.labels.indexOf(e.name) >= 0) {
labels.push(e.name);
}
});
if(labels.length) {
issueLines.push('['+labels.join(',') + '] #'+issue.number+': '+issue.title+' (' + (issue.assignee ? ('@'+issue.assignee.login) : '') + ')');
}
});

lines = lines.concat(issueLines);
console.log('Loaded issues for ' + ms.title + ': ' + issueLines.length);
});

fs.writeFileSync(options.dest, lines.join("\r\n"), 'utf8');
Expand All @@ -60,7 +74,6 @@ module.exports = function(grunt) {
return function(err2, issues) {
r.issues = issues;
finished++;
console.log('Loaded issues for ' + r.title + ': '+issues.length);
if(finished == res.length) {
writeFile();
done(true);
Expand Down

0 comments on commit 30aaf57

Please sign in to comment.