aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cakefile28
1 files changed, 15 insertions, 13 deletions
diff --git a/Cakefile b/Cakefile
index ffd8308b..63c544c1 100644
--- a/Cakefile
+++ b/Cakefile
@@ -3,16 +3,21 @@ fs = require "fs"
path = require "path"
child_process = require "child_process"
-spawn = (procName, optArray, silent=false) ->
+spawn = (procName, optArray, silent = false, sync = false) ->
if process.platform is "win32"
# if win32, prefix arguments with "/c {original command}"
# e.g. "coffee -c c:\git\vimium" becomes "cmd.exe /c coffee -c c:\git\vimium"
optArray.unshift "/c", procName
procName = "cmd.exe"
- proc = child_process.spawn procName, optArray
- unless silent
- proc.stdout.on 'data', (data) -> process.stdout.write data
- proc.stderr.on 'data', (data) -> process.stderr.write data
+ if sync
+ proc = child_process.spawnSync procName, optArray, {
+ stdio: [undefined, process.stdout, process.stderr]
+ }
+ else
+ proc = child_process.spawn procName, optArray
+ unless silent
+ proc.stdout.on 'data', (data) -> process.stdout.write data
+ proc.stderr.on 'data', (data) -> process.stderr.write data
proc
optArrayFromDict = (opts) ->
@@ -56,24 +61,21 @@ task "autobuild", "continually rebuild coffeescript files using coffee --watch",
coffee = spawn "coffee", ["-cw", __dirname]
task "package", "Builds a zip file for submission to the Chrome store. The output is in dist/", ->
- # To get exec-sync, `npm install exec-sync`. We use this for synchronously executing shell commands.
- execSync = require("exec-sync")
-
vimium_version = JSON.parse(fs.readFileSync("manifest.json").toString())["version"]
invoke "build"
- execSync "rm -rf dist/vimium"
- execSync "mkdir -p dist/vimium"
+ spawn "rm", ["-rf", "dist/vimium"], false, true
+ spawn "mkdir", ["-p", "dist/vimium"], false, true
blacklist = [".*", "*.coffee", "*.md", "reference", "test_harnesses", "tests", "dist", "git_hooks",
"CREDITS", "node_modules", "MIT-LICENSE.txt", "Cakefile"]
rsyncOptions = [].concat.apply(
["-r", ".", "dist/vimium"],
- blacklist.map((item) -> ["--exclude", "'#{item}'"]))
+ blacklist.map((item) -> ["--exclude", "#{item}"]))
- execSync "rsync " + rsyncOptions.join(" ")
- execSync "cd dist && zip -r vimium-#{vimium_version}.zip vimium"
+ spawn "rsync", rsyncOptions, false, true
+ spawn "zip", ["-r", "dist/vimium-#{vimium_version}.zip", "dist/vimium"], false, true
# This builds a CRX that's distributable outside of the Chrome web store. Is this used by folks who fork
# Vimium and want to distribute their fork?