Skip to content

Commit

Permalink
added config changelog.releases.skipEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
drewfish committed May 12, 2012
1 parent 05c8041 commit e2c3484
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Readme.md
Expand Up @@ -106,6 +106,8 @@ updates changelog. {file} defaults to `Changelog.md`
* `regexp`: string
* `replace`: string
* if results in `--CRANK:SKIP--` then version is skipped
* `skipEmpty`: boolean
* if true and version has no changes (after filtering), then the version is skipped


## template
Expand Down
3 changes: 3 additions & 0 deletions crank.json
Expand Up @@ -17,6 +17,9 @@
"replace": "--CRANK:SKIP--"
}
]
},
"releases": {
"skipEmpty": true
}
}
}
8 changes: 8 additions & 0 deletions lib/op-changelog.js
Expand Up @@ -73,13 +73,16 @@ OPChangelog.prototype.run = function(command) {
currentChangeID,
latestChangeID,
changes,
skipEmpty,
latestVersion,
rendered = '';

if (command.args[0]) {
this.base.config.changelog.file = command.args.shift();
}

skipEmpty = me.base.config.changelog.releases && me.base.config.changelog.releases.skipEmpty;

libasync.series([

// read db
Expand Down Expand Up @@ -151,6 +154,11 @@ OPChangelog.prototype.run = function(command) {

changes = me.base.filter(changes,
me.base.config.changelog.changes.filters);
if (!changes.length && skipEmpty) {
console.log('NOTICE: skipped empty release ' + latestVersion);
return;
}
me.base.config.changelog.releases
changes.forEach(function(change) {
change.date = libdateformat(change.date,
me.base.config.changelog.changes.dateformat);
Expand Down

0 comments on commit e2c3484

Please sign in to comment.