Change tests_enabled to environment variable.

This commit is contained in:
ccd0 2016-04-10 03:16:43 -07:00
parent da08e6dc2e
commit 14f32a7dec
6 changed files with 7 additions and 20 deletions

View File

@ -85,7 +85,7 @@ module.exports = (grunt) ->
""".split('\n').join('&&') """.split('\n').join('&&')
crx: crx:
command: """ command: """
<%= BIN %>coffee tools/templates.coffee tmp/script.coffee tmp/script-crx.coffee type=crx tests_enabled=<%= pkg.tests_enabled || "" %> <%= BIN %>coffee tools/templates.coffee tmp/script.coffee tmp/script-crx.coffee type=crx
<%= BIN %>coffee --no-header -c tmp/script-crx.coffee <%= BIN %>coffee --no-header -c tmp/script-crx.coffee
<%= BIN %>coffee --no-header -o tmp -c src/General/eventPage.coffee <%= BIN %>coffee --no-header -o tmp -c src/General/eventPage.coffee
<%= BIN %>jshint tmp/script-crx.js tmp/eventPage.js <%= BIN %>jshint tmp/script-crx.js tmp/eventPage.js
@ -102,7 +102,7 @@ module.exports = (grunt) ->
command: 'node tools/cp.js testbuilds/<%= pkg.name %>-noupdate.crx.zip testbuilds/<%= pkg.name %>.zip' command: 'node tools/cp.js testbuilds/<%= pkg.name %>-noupdate.crx.zip testbuilds/<%= pkg.name %>.zip'
userscript: userscript:
command: """ command: """
<%= BIN %>coffee tools/templates.coffee tmp/script.coffee tmp/script-userscript.coffee type=userscript tests_enabled=<%= pkg.tests_enabled || "" %> <%= BIN %>coffee tools/templates.coffee tmp/script.coffee tmp/script-userscript.coffee type=userscript
<%= BIN %>coffee --no-header -c tmp/script-userscript.coffee <%= BIN %>coffee --no-header -c tmp/script-userscript.coffee
<%= BIN %>jshint tmp/script-userscript.js <%= BIN %>jshint tmp/script-userscript.js
""".split('\n').join('&&') """.split('\n').join('&&')
@ -198,11 +198,6 @@ module.exports = (grunt) ->
pkg.channel = channel pkg.channel = channel
grunt.config 'pkg', pkg grunt.config 'pkg', pkg
grunt.registerTask 'enable-tests', 'Include testing code', () ->
pkg = grunt.config 'pkg'
pkg.tests_enabled = true
grunt.config 'pkg', pkg
grunt.registerTask 'build', [ grunt.registerTask 'build', [
'shell:npm' 'shell:npm'
'shell:general' 'shell:general'
@ -264,14 +259,6 @@ module.exports = (grunt) ->
'shell:install' 'shell:install'
] ]
grunt.registerTask 'build-tests', [
'shell:npm'
'enable-tests'
'shell:general'
'build-crx'
'build-userscript'
]
grunt.registerTask 'clean', [ grunt.registerTask 'clean', [
'shell:clean' 'shell:clean'
] ]

View File

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

View File

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

View File

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

View File

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

View File

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