From 14f32a7dec1dec07cd23c41542f3af2d31ff2918 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 10 Apr 2016 03:16:43 -0700 Subject: [PATCH] Change tests_enabled to environment variable. --- Gruntfile.coffee | 17 ++--------------- src/General/BuildTest.coffee | 2 +- src/General/Main.coffee | 2 +- src/Miscellaneous/Keybinds.coffee | 2 +- src/Monitoring/Unread.coffee | 2 +- src/classes/Post.coffee | 2 +- 6 files changed, 7 insertions(+), 20 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 654c283b8..8e0fa632f 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -85,7 +85,7 @@ module.exports = (grunt) -> """.split('\n').join('&&') crx: 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 -o tmp -c src/General/eventPage.coffee <%= 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' userscript: 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 %>jshint tmp/script-userscript.js """.split('\n').join('&&') @@ -198,11 +198,6 @@ module.exports = (grunt) -> pkg.channel = channel 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', [ 'shell:npm' 'shell:general' @@ -264,14 +259,6 @@ module.exports = (grunt) -> 'shell:install' ] - grunt.registerTask 'build-tests', [ - 'shell:npm' - 'enable-tests' - 'shell:general' - 'build-crx' - 'build-userscript' - ] - grunt.registerTask 'clean', [ 'shell:clean' ] diff --git a/src/General/BuildTest.coffee b/src/General/BuildTest.coffee index 8bf1c9219..93b0fdc35 100644 --- a/src/General/BuildTest.coffee +++ b/src/General/BuildTest.coffee @@ -1,4 +1,4 @@ -<% if (tests_enabled) { %> +<% if (process.env.tests_enabled) { %> BuildTest = init: -> return if !Conf['Menu'] or g.VIEW not in ['index', 'thread'] diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 25267f9f6..0eb4e6f9c 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -469,7 +469,7 @@ Main = ['Banner', Banner] ['Flash Features', Flash] ['Reply Pruning', ReplyPruning] - <% if (tests_enabled) { %> + <% if (process.env.tests_enabled) { %> ['Build Test', BuildTest] <% } %> ] diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 4bb527170..d3de5ffa8 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -192,7 +192,7 @@ Keybinds = when Conf['Next Post Quoting You'] return unless threadRoot and QuoteYou.db QuoteYou.cb.seek 'following' - <% if (tests_enabled) { %> + <% if (process.env.tests_enabled) { %> when 't' return unless threadRoot BuildTest.testAll() diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 67220c214..00dd6944c 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -28,7 +28,7 @@ Unread = name: 'Unread' cb: @addPost - <% if (tests_enabled) { %> + <% if (process.env.tests_enabled) { %> testLink = $.el 'a', textContent: 'Test Post Order' $.on testLink, 'click', -> diff --git a/src/classes/Post.coffee b/src/classes/Post.coffee index af94dcf20..8018751df 100644 --- a/src/classes/Post.coffee +++ b/src/classes/Post.coffee @@ -3,7 +3,7 @@ class Post toString: -> @ID constructor: (root, @thread, @board) -> - <% if (tests_enabled) { %> + <% if (process.env.tests_enabled) { %> root2 = root.cloneNode true for el in $$ '.mobile', root2 $.rm el