Store tests_enabled flag in file.

This commit is contained in:
ccd0 2016-04-10 20:00:48 -07:00
parent 550d33bc0f
commit b746a0b054
8 changed files with 19 additions and 5 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ captchas.html
install.json
Gruntfile.js
.jshintrc
.tests_enabled

View File

@ -76,6 +76,10 @@ 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
@ -205,6 +209,14 @@ module.exports = (grunt) ->
grunt.registerTask 'build', [
'shell:npm'
'shell:tests-false'
'shell:general'
'concurrent:build'
]
grunt.registerTask 'build-tests', [
'shell:npm'
'shell:tests-true'
'shell:general'
'concurrent:build'
]

View File

@ -1,4 +1,4 @@
<% if (process.env.tests_enabled) { %>
<% if (grunt.file.readJSON('.tests_enabled')) { %>
BuildTest =
init: ->
return if !Conf['Menu'] or g.VIEW not in ['index', 'thread']

View File

@ -469,7 +469,7 @@ Main =
['Banner', Banner]
['Flash Features', Flash]
['Reply Pruning', ReplyPruning]
<% if (process.env.tests_enabled) { %>
<% if (grunt.file.readJSON('.tests_enabled')) { %>
['Build Test', BuildTest]
<% } %>
]

View File

@ -192,7 +192,7 @@ Keybinds =
when Conf['Next Post Quoting You']
return unless threadRoot and QuoteYou.db
QuoteYou.cb.seek 'following'
<% if (process.env.tests_enabled) { %>
<% if (grunt.file.readJSON('.tests_enabled')) { %>
when 't'
return unless threadRoot
BuildTest.testAll()

View File

@ -28,7 +28,7 @@ Unread =
name: 'Unread'
cb: @addPost
<% if (process.env.tests_enabled) { %>
<% if (grunt.file.readJSON('.tests_enabled')) { %>
testLink = $.el 'a',
textContent: 'Test Post Order'
$.on testLink, 'click', ->

View File

@ -3,7 +3,7 @@ class Post
toString: -> @ID
constructor: (root, @thread, @board) ->
<% if (process.env.tests_enabled) { %>
<% if (grunt.file.readJSON('.tests_enabled')) { %>
root2 = root.cloneNode true
for el in $$ '.mobile', root2
$.rm el

View File

@ -4,3 +4,4 @@ fs.removeSync('tmp');
fs.removeSync('testbuilds');
fs.removeSync('builds');
fs.removeSync('.jshintrc');
fs.removeSync('.tests_enabled');