diff options
| author | mrmr1993 | 2015-07-13 01:23:14 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2015-07-13 01:39:32 +0100 | 
| commit | 02c2f8172a3456bfae1a560ba4c9ee48673a60dc (patch) | |
| tree | 0a9a18e2b6aea954bb0286e8c1742d3b83439429 /Cakefile | |
| parent | 51b21408870fbcd2e59c806a24082d9bdd5c5e84 (diff) | |
| download | vimium-02c2f8172a3456bfae1a560ba4c9ee48673a60dc.tar.bz2 | |
Use spawn instead of exec-sync for cake package
exec-sync fails to build for some environments and architectures
(including mine). As spawn is already necessary for building, we know
it will be available, and so can use that via a callback chain to run
the packaging tasks.
Diffstat (limited to 'Cakefile')
| -rw-r--r-- | Cakefile | 26 | 
1 files changed, 16 insertions, 10 deletions
| @@ -15,6 +15,14 @@ spawn = (procName, optArray, silent=false) ->      proc.stderr.on 'data', (data) -> process.stderr.write data    proc +spawnMultiple = (spawnDetailsArray, callback) -> +  return callback?() if spawnDetailsArray.length == 0 +  {procName, optArray, silent} = spawnDetailsArray.shift() +  process = spawn procName, optArray, silent +  process.on 'exit', (returnCode) -> +    if returnCode == 0 +      spawnMultiple spawnDetailsArray, callback +  optArrayFromDict = (opts) ->    result = []    for key, value of opts @@ -56,24 +64,22 @@ 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" -    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}'"])) - -  execSync "rsync " + rsyncOptions.join(" ") -  execSync "cd dist && zip -r vimium-#{vimium_version}.zip vimium" +    blacklist.map((item) -> ["--exclude", "#{item}"])) + +  spawnMultiple [ +    {procName: "rm", optArray: ["-rf", "dist/vimium"]}, +    {procName: "mkdir", optArray: ["-p", "dist/vimium"]}, +    {procName: "rsync", optArray: rsyncOptions}, +    {procName: "zip", optArray: ["-r", "dist/vimium-#{vimium_version}.zip", "dist/vimium"]} +  ]  # 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? | 
