diff --git a/Gruntfile.js b/Gruntfile.js index f3af756..92fea4b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -129,6 +129,17 @@ module.exports = function(grunt) { files: { src: '_site/**/*.html' } + }, + + sed: { + versionNumber: { + pattern: (function () { + var old = grunt.option('oldver'); + return old ? RegExp.quote(old) : old; + })(), + replacement: grunt.option('newver'), + recursive: true + } } }); @@ -142,4 +153,9 @@ module.exports = function(grunt) { grunt.registerTask('validate-html', ['jekyll', 'validation']); grunt.registerTask('default', ['dist']); grunt.registerTask('build', ['dist']); + + // Version numbering task. + // grunt change-version-number --oldver=A.B.C --newver=X.Y.Z + // This can be overzealous, so its changes should always be manually reviewed! + grunt.registerTask('change-version-number', 'sed'); }; diff --git a/package.json b/package.json index a039263..9a99b01 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "grunt-contrib-watch": "~0.5.3", "grunt-html-validation": "~0.1.13", "grunt-jekyll": "~0.4.1", + "grunt-sed": "~0.1.1", "load-grunt-tasks": "~0.4.0" } }