From b3860d19323df7c6de659e5231b85d4a09fa7c08 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 25 Feb 2014 18:40:53 -0800 Subject: [PATCH] import change-version-number Grunt task from Bootstrap --- Gruntfile.js | 16 ++++++++++++++++ package.json | 1 + 2 files changed, 17 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 9b6849d..ef4bf5c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -138,6 +138,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 + } } }); @@ -152,4 +163,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 b0fc230..d81ccda 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,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" } }