Commit 07a9b374 authored by Tim Branyen's avatar Tim Branyen

Prebuilt fallback now works thanks to node-pre-gyp.

parent f2a79444
......@@ -68,8 +68,6 @@ var dependencies = Q.allSettled([
.then(function(results) {
console.info('[nodegit] Determining dependencies.');
//throw new Error("can't build");
// Assign to reusable variables.
python = results[0].value || results[1].value;
cmake = results[2].value;
......@@ -173,45 +171,41 @@ var dependencies = Q.allSettled([
});
})
// Display a success message.
.then(function() {
console.info('[nodegit] Completed installation successfully.');
})
// Display a warning message about failing to build native node module.
// Attempt to fallback on a prebuilt binary.
.fail(function(message) {
console.info('[nodegit] Failed to build nodegit.');
console.info(message.message);
console.info(message.stack);
// Attempt the prebuilt fallback.
console.info('[nodegit] Removing vendor/libgit2.');
console.info('[nodegit] Attempting to fallback on a prebuilt binary.');
return Q.ninvoke(rimraf, null, paths.release).then(function() {
console.info('[nodegit] Creating build/Release.');
function fetchPrebuilt() {
console.info('[nodegit] Fetching binary from S3.');
// Attempt to fetch prebuilt binary.
return Q.ninvoke(fs, 'mkdir', paths.release).then(function() {
console.info('[nodegit] Attempting to fetch a prebuilt binary.');
var version = [
process.platform, process.arch, require("./package.json").version
].join('_');
var url = 'https://s3.amazonaws.com/nodegit/' + version;
var extract = tar.Extract({
path: paths.release,
strip: true
});
// Using the node-pre-gyp module, attempt to fetch a compatible build.
return Q.nfcall(exec, './node_modules/.bin/node-pre-gyp install');
}
var expand = request.get(url).pipe(zlib.createUnzip()).pipe(extract);
// Attempt to fetch prebuilt binary.
return Q.ninvoke(fs, 'mkdir', paths.release)
.then(fetchPrebuilt, fetchPrebuilt);
})
return Q.ninvoke(expand, 'on', 'end');
})
// Display a warning message about failing to build native node module.
.fail(function(message) {
console.info('[nodegit] Failed to build and install nodegit.');
console.info(message.message);
console.info(message.stack);
})
.then(function() {
console.info('[nodegit] Completed installation successfully.');
});
});
// Display a success message.
.then(function() {
console.info('[nodegit] Completed installation successfully.');
})
// Display a warning message about failing to build native node module.
.fail(function(message) {
console.info('[nodegit] Failed to build nodegit.');
console.info(message.message);
console.info(message.stack);
});
......@@ -30,21 +30,31 @@
"engines": {
"node": ">= 0.8"
},
"bundledDependencies": [
"node-pre-gyp"
],
"dependencies": {
"request": "~2.25.0",
"node-gyp": "~0.13.0",
"tar": "~0.1.18",
"which": "~1.0.5",
"q": "~0.9.6",
"fs-extra": "0.6.0",
"fs-extra": "~0.9.1",
"nan": "~1.2.0",
"rimraf": "~2.2.6"
"node-gyp": "~0.13.1",
"node-pre-gyp": "~0.5.16",
"q": "~1.0.1",
"request": "~2.36.0",
"rimraf": "~2.2.8",
"tar": "~0.1.19",
"which": "~1.0.5"
},
"devDependencies": {
"jshint": "~2.4.4",
"nodeunit": "~0.8.6",
"async": "~0.9.0",
"aws-sdk": "~2.0.0-rc.19",
"ejs": "~1.0.0",
"async": "~0.2.10"
"jshint": "~2.5.1",
"nodeunit": "~0.9.0"
},
"binary": {
"module_name": "nodegit",
"module_path": "./build/Release/",
"host": "https://s3.amazonaws.com/nodegit/nodegit"
},
"scripts": {
"lint": "jshint src",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment