Skip to content

Commit

Permalink
feat(grunt): Adds version bumping to release
Browse files Browse the repository at this point in the history
When using the grunt:release task with the --as parameter, the package.json
and bower.json files are updated. This minimizes errors during the release
process.
  • Loading branch information
jakobo committed Nov 20, 2013
1 parent 15d14fa commit 8bbbf1a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
23 changes: 23 additions & 0 deletions gruntfile.js
Expand Up @@ -352,6 +352,21 @@ module.exports = function (grunt) {
version: '<%= version_string %>'
}
},

bumpup: {
options: {
dateformat: 'YYYY-MM-DD HH:mm'
},
setters: {
version: function (old, releaseType, options) {
return grunt.config.get('version_string');
}
},
files: [
'package.json',
'bower.json'
]
},

versionFromParam: {},
noop: {},
Expand All @@ -369,6 +384,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-express');
grunt.loadNpmTasks('grunt-conventional-changelog');
grunt.loadNpmTasks('grunt-bumpup');

grunt.registerMultiTask('log', 'Print some messages', function() {
grunt.log.writeln(this.data.options.message);
Expand Down Expand Up @@ -427,6 +443,7 @@ module.exports = function (grunt) {
'compress:release',
'log:release',
(grunt.option('as')) ? 'genlog' : 'noop',
(grunt.option('as')) ? 'setversion' : 'noop',
(grunt.option('as')) ? 'tagit' : 'noop'
]);

Expand All @@ -436,6 +453,12 @@ module.exports = function (grunt) {
'changelog'
]);

grunt.registerTask('setversion', [
(grunt.option('as')) ? 'versionFromParam' : 'noop',
(grunt.option('as')) ? 'noop' : 'autofail',
'bumpup'
]);

grunt.registerTask('tagit', [
(grunt.option('as')) ? 'versionFromParam' : 'noop',
(grunt.option('as')) ? 'noop' : 'autofail',
Expand Down
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -44,8 +44,9 @@
"grunt-shell": "~0.2.1",
"grunt-express": "~0.2.0",
"express": "~3.0.0",
"grunt-conventional-changelog": "~1.0.0"
"grunt-conventional-changelog": "~1.0.0",
"grunt-bumpup": "~0.4.2"
},
"dependencies": {},
"engine": "node >= 0.8.10"
}
}

0 comments on commit 8bbbf1a

Please sign in to comment.