From 8ae1a0df96094ca390fe94ca2e9c4f39a8617071 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 9 Apr 2016 18:39:10 -0700 Subject: [PATCH] Make templates.coffee take keyword arguments. --- Gruntfile.coffee | 10 +++++----- tools/templates.coffee | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index ee0d3e2bd..bd05dd46c 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -115,24 +115,24 @@ module.exports = (grunt) -> command: 'node_modules/.bin/coffee tools/templates.coffee src/meta/jshint.json .jshintrc'.replace(/\//g, path.sep) crx: command: """ - node_modules/.bin/coffee tools/templates.coffee tmp/script.coffee tmp/script-crx.coffee crx - <%= pkg.tests_enabled || "" %> + node_modules/.bin/coffee tools/templates.coffee tmp/script.coffee tmp/script-crx.coffee type=crx tests_enabled=<%= pkg.tests_enabled || "" %> node_modules/.bin/coffee --no-header -c tmp/script-crx.coffee node_modules/.bin/coffee --no-header -o tmp -c src/General/eventPage.coffee node_modules/.bin/jshint tmp/script-crx.js tmp/eventPage.js """.split('\n').join('&&').replace(/\//g, path.sep) 'templates-crx-meta': command: """ - node_modules/.bin/coffee tools/templates.coffee src/meta/updates.xml testbuilds/updates<%= pkg.meta.suffix[pkg.channel] %>.xml crx <%= pkg.channel %> - node_modules/.bin/coffee tools/templates.coffee src/meta/manifest.json testbuilds/crx<%= pkg.meta.suffix[pkg.channel] %>/manifest.json crx <%= pkg.channel %> + node_modules/.bin/coffee tools/templates.coffee src/meta/updates.xml testbuilds/updates<%= pkg.meta.suffix[pkg.channel] %>.xml type=crx channel=<%= pkg.channel %> + node_modules/.bin/coffee tools/templates.coffee src/meta/manifest.json testbuilds/crx<%= pkg.meta.suffix[pkg.channel] %>/manifest.json type=crx channel=<%= pkg.channel %> """.split('\n').join('&&').replace(/\//g, path.sep) userscript: command: """ - node_modules/.bin/coffee tools/templates.coffee tmp/script.coffee tmp/script-userscript.coffee userscript - <%= pkg.tests_enabled || "" %> + node_modules/.bin/coffee tools/templates.coffee tmp/script.coffee tmp/script-userscript.coffee type=userscript tests_enabled=<%= pkg.tests_enabled || "" %> node_modules/.bin/coffee --no-header -c tmp/script-userscript.coffee node_modules/.bin/jshint tmp/script-userscript.js """.split('\n').join('&&').replace(/\//g, path.sep) 'templates-userscript-meta': - command: 'node_modules/.bin/coffee tools/templates.coffee src/meta/metadata.js testbuilds/<%= pkg.name %><%= pkg.meta.suffix[pkg.channel] %>.meta.js userscript <%= pkg.channel %>'.replace(/\//g, path.sep) + command: 'node_modules/.bin/coffee tools/templates.coffee src/meta/metadata.js testbuilds/<%= pkg.name %><%= pkg.meta.suffix[pkg.channel] %>.meta.js type=userscript channel=<%= pkg.channel %>'.replace(/\//g, path.sep) markdown: command: 'node tools/markdown.js' commit: diff --git a/tools/templates.coffee b/tools/templates.coffee index 4a0394da2..bbe97f76f 100644 --- a/tools/templates.coffee +++ b/tools/templates.coffee @@ -85,9 +85,9 @@ pkg.grunt = file: readJSON: (filename) -> JSON.parse read filename expand: glob.sync -pkg.type = process.argv[4] -pkg.channel = process.argv[5] -pkg.tests_enabled = !!process.argv[6] +for arg in process.argv[4..] + [key, val] = arg.match(/(.*?)=(.*)/)[1..] + pkg[key] = val dir = path.dirname process.argv[3] fs.mkdirSync dir unless fs.existsSync dir