Don't rewrite .tests_enabled unless needed.

This commit is contained in:
ccd0 2016-04-10 21:08:49 -07:00
parent c8fcf610c9
commit 0fe7e6e11e

View File

@ -76,10 +76,6 @@ module.exports = (grunt) ->
failOnError: true failOnError: true
clean: clean:
command: 'node tools/clean.js' command: 'node tools/clean.js'
'tests-false':
command: 'echo false> .tests_enabled'
'tests-true':
command: 'echo true> .tests_enabled'
general: general:
command: """ command: """
<%= BIN %>coffee tools/templates.coffee src/meta/jshint.json .jshintrc <%= BIN %>coffee tools/templates.coffee src/meta/jshint.json .jshintrc
@ -207,16 +203,23 @@ module.exports = (grunt) ->
'build' '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', [ grunt.registerTask 'build', [
'shell:npm' 'shell:npm'
'shell:tests-false' 'set-tests:false'
'shell:general' 'shell:general'
'concurrent:build' 'concurrent:build'
] ]
grunt.registerTask 'build-tests', [ grunt.registerTask 'build-tests', [
'shell:npm' 'shell:npm'
'shell:tests-true' 'set-tests:true'
'shell:general' 'shell:general'
'concurrent:build' 'concurrent:build'
] ]