From 0fe7e6e11e79d607f7d38f143d9026509128ac8d Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 10 Apr 2016 21:08:49 -0700 Subject: [PATCH] Don't rewrite .tests_enabled unless needed. --- Gruntfile.coffee | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index b57ef0854..2d3621d3d 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -76,10 +76,6 @@ module.exports = (grunt) -> failOnError: true clean: command: 'node tools/clean.js' - 'tests-false': - command: 'echo false> .tests_enabled' - 'tests-true': - command: 'echo true> .tests_enabled' general: command: """ <%= BIN %>coffee tools/templates.coffee src/meta/jshint.json .jshintrc @@ -207,16 +203,23 @@ module.exports = (grunt) -> 'build' ] + grunt.registerTask 'set-tests', 'Set whether to include testing code', (value) -> + try + oldValue = grunt.file.readJSON '.tests_enabled' + catch + unless oldValue is JSON.parse value + grunt.file.write '.tests_enabled', value + grunt.registerTask 'build', [ 'shell:npm' - 'shell:tests-false' + 'set-tests:false' 'shell:general' 'concurrent:build' ] grunt.registerTask 'build-tests', [ 'shell:npm' - 'shell:tests-true' + 'set-tests:true' 'shell:general' 'concurrent:build' ]