diff options
| author | Phil Crosby | 2015-09-09 23:09:32 +0200 | 
|---|---|---|
| committer | Phil Crosby | 2015-09-09 23:09:32 +0200 | 
| commit | 9edf2fcbc4d1694b4163fa5260591faf568f2906 (patch) | |
| tree | 9f5b71daf18669c0df1bd6ed171195bf6e1c31a7 | |
| parent | 71a6be06a179fd1121b7feb3fe7d30e4e98e4f78 (diff) | |
| parent | 2f990121abbb403d7c7e0304cf629b84ea0dde59 (diff) | |
| download | vimium-9edf2fcbc4d1694b4163fa5260591faf568f2906.tar.bz2 | |
Merge pull request #1764 from mrmr1993/use-sync-for-cake-package
Use spawn instead of exec-sync for cake package
| -rw-r--r-- | Cakefile | 28 | 
1 files changed, 15 insertions, 13 deletions
| @@ -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? | 
