Add a grunt task to update the changelog file when bumping the version.

This commit is contained in:
Nicolas Stepien 2013-03-13 23:42:48 +01:00
parent 968cb9744b
commit cd8faebb78
2 changed files with 12 additions and 4 deletions

View File

@ -30,8 +30,7 @@ Open your console with:
### Release
- To patch, run `grunt patch` (`0.0.x` version bump).
- To upgrade, run `grunt upgrade` (`0.x.0` version bump).
- Update the version with `grunt patch`, `grunt minor` or `grunt major`.
- Release with `grunt release`.
Note: this is only used to release new 4chan X versions, and is **not** needed or wanted in pull requests.

View File

@ -91,7 +91,16 @@ module.exports = function(grunt) {
grunt.registerTask('default', ['concat:coffee', 'coffee:script', 'concat:script', 'concat:metadata', 'clean']);
grunt.registerTask('release', ['default', 'exec:commit', 'exec:push']);
grunt.registerTask('patch', ['bump']);
grunt.registerTask('upgrade', ['bump:minor']);
grunt.registerTask('patch', ['bump', 'updcl:3']);
grunt.registerTask('minor', ['bump:minor', 'updcl:2']);
grunt.registerTask('major', ['bump:major', 'updcl:1']);
grunt.registerTask('updcl', 'Update the changelog', function(i) {
// Update the `pkg` object with the new version.
pkg = grunt.file.readJSON('package.json');
// i is the number of #s for markdown.
var version = new Array(+i + 1).join('#') + ' ' + pkg.version;
grunt.file.write('CHANGELOG.md', version + '\n' + grunt.file.read('CHANGELOG.md'));
grunt.log.ok('Changelog updated for v' + pkg.version + '.');
});
};