Permalink
Browse files

labels filter in changelog task

  • Loading branch information...
1 parent 42cf458 commit 30aaf575e385cdb65f06153d2e49e7c348066163 @vitalets committed Aug 17, 2012
Showing with 28 additions and 5 deletions.
  1. +11 −1 grunt.js
  2. +17 −4 tasks/changelog.js
View
@@ -31,6 +31,7 @@ module.exports = function(grunt) {
changelog: {
user: 'vitalets',
repo: 'bootstrap-editable'
+ //labels: ['enhancement']
},
min: {
dist: {
@@ -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/**"]
}
}
},
View
@@ -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({
@@ -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');
@@ -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);

0 comments on commit 30aaf57

Please sign in to comment.