Commit 0bb122a3 authored by Chris Rebert's avatar Chris Rebert

add Grunt task to change version numbers; fixes #11332

parent 4e0d022d
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module.exports = function(grunt) { module.exports = function(grunt) {
"use strict"; "use strict";
RegExp.quote = require('regexp-quote')
var btoa = require('btoa') var btoa = require('btoa')
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
...@@ -156,6 +157,17 @@ module.exports = function(grunt) { ...@@ -156,6 +157,17 @@ module.exports = function(grunt) {
files: 'less/*.less', files: 'less/*.less',
tasks: ['recess'] tasks: ['recess']
} }
},
sed: {
versionNumber: {
pattern: (function () {
var old = grunt.option('oldver')
return old ? RegExp.quote(old) : old
})(),
replacement: grunt.option('newver'),
recursive: true
}
} }
}); });
...@@ -173,6 +185,7 @@ module.exports = function(grunt) { ...@@ -173,6 +185,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-html-validation'); grunt.loadNpmTasks('grunt-html-validation');
grunt.loadNpmTasks('grunt-jekyll'); grunt.loadNpmTasks('grunt-jekyll');
grunt.loadNpmTasks('grunt-recess'); grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-sed');
// Docs HTML validation task // Docs HTML validation task
grunt.registerTask('validate-html', ['jekyll', 'validation']); grunt.registerTask('validate-html', ['jekyll', 'validation']);
...@@ -203,6 +216,11 @@ module.exports = function(grunt) { ...@@ -203,6 +216,11 @@ module.exports = function(grunt) {
// Default task. // Default task.
grunt.registerTask('default', ['test', 'dist', 'build-customizer']); grunt.registerTask('default', ['test', 'dist', 'build-customizer']);
// 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']);
// task for building customizer // task for building customizer
grunt.registerTask('build-customizer', 'Add scripts/less files to customizer.', function () { grunt.registerTask('build-customizer', 'Add scripts/less files to customizer.', function () {
var fs = require('fs') var fs = require('fs')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment