diff --git a/package.json b/package.json index 7eed0556b..4b46cc894 100644 --- a/package.json +++ b/package.json @@ -21,11 +21,12 @@ "grunt-curl": "0.5.0", "grunt-shell": "0.2.1", "q": "0.9.2", + "adm-zip": "0.4.4", "semver": "2.0.11" }, "scripts": { - "preinstall": "bash -c 'mv appshell.gyp .appshell.gyp'", + "preinstall": "node -e \"var fs=require('fs');var n='appshell.gyp';fs.renameSync(n,'.'+n);\"", "install": "", - "postinstall": "bash -c 'mv .appshell.gyp appshell.gyp;'" + "postinstall": "node -e \"var fs=require('fs');var n='appshell.gyp';fs.renameSync('.'+n,n);\"" } } \ No newline at end of file diff --git a/tasks/setup.js b/tasks/setup.js index 1bacf1f5f..42e59fb4b 100644 --- a/tasks/setup.js +++ b/tasks/setup.js @@ -21,7 +21,7 @@ * */ /*jslint vars:true*/ -/*global module, require, process*/ +/*global module, require, process, setTimeout*/ module.exports = function (grunt) { "use strict"; @@ -30,6 +30,7 @@ module.exports = function (grunt) { child_process = require("child_process"), path = require("path"), q = require("q"), + AdmZip = require('adm-zip'), /* win only (lib), mac only (Resources, tools) */ CEF_MAPPING = { "deps/cef/Debug" : "Debug", @@ -64,7 +65,17 @@ module.exports = function (grunt) { function unzip(src, dest) { grunt.verbose.writeln("Extracting " + src); - return exec("unzip -q " + src + " -d " + dest); + var deferred = q.defer(); + var zip = new AdmZip(src); + setTimeout(function() { + try { + zip.extractAllTo(dest); + deferred.resolve(); + } catch(err) { + deferred.reject(err); + } + }); + return deferred.promise; } // task: cef @@ -317,6 +328,8 @@ module.exports = function (grunt) { if (platform === "linux") { gypCommand = "bash -c 'python2 gyp/gyp --depth=.'"; + } else if (platform === "win") { + gypCommand = "cmd /C \"gyp\\gyp appshell.gyp -I common.gypi --depth=.\""; } else { gypCommand = "bash -c 'gyp/gyp appshell.gyp -I common.gypi --depth=.'"; }