From d0a44e6a48c2401d07263ce1c8d71c6fa582e539 Mon Sep 17 00:00:00 2001 From: SATO taichi Date: Thu, 20 Mar 2014 16:32:52 +0900 Subject: [PATCH 1/3] use javascript instead of bash. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7eed0556b..7482ea045 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "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 From 1df43170a31e8d8393ca7a5b96450a30ba1a2671 Mon Sep 17 00:00:00 2001 From: SATO taichi Date: Thu, 20 Mar 2014 20:59:49 +0900 Subject: [PATCH 2/3] use adm-zip instead of unzip. because windows don't have unzip binary. --- package.json | 1 + tasks/setup.js | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7482ea045..4b46cc894 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "grunt-curl": "0.5.0", "grunt-shell": "0.2.1", "q": "0.9.2", + "adm-zip": "0.4.4", "semver": "2.0.11" }, "scripts": { diff --git a/tasks/setup.js b/tasks/setup.js index 1bacf1f5f..40dc3f919 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 From 21a4ca96db812aee3f5db97cae3b902f5a8a537d Mon Sep 17 00:00:00 2001 From: SATO taichi Date: Thu, 20 Mar 2014 21:00:05 +0900 Subject: [PATCH 3/3] use cmd instead of bash. --- tasks/setup.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/setup.js b/tasks/setup.js index 40dc3f919..42e59fb4b 100644 --- a/tasks/setup.js +++ b/tasks/setup.js @@ -328,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=.'"; }