Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions install.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var os = require("os");
var path = require("path");
var zlib = require("zlib");
var tar = require("tar");
var tar;
var request;

var Promise = require("nodegit-promise");
var promisify = require("promisify-node");
var request = require("request");
var fse = promisify(require("fs-extra"));
var findParentDir = promisify(require('find-parent-dir'));
fse.ensureDir = promisify(fse.ensureDir, function() { return true; });
Expand All @@ -14,6 +14,7 @@ var exec = promisify(function(command, opts, callback) {
return require("child_process").exec(command, opts, callback);
});


var NODE_VERSION = Number(process.version.match(/^v(\d+\.\d+)/)[1]);

// If the build only flag is set.
Expand Down Expand Up @@ -96,17 +97,23 @@ function compile(err) {
console.info("[nodegit] Failed to install prebuilt, attempting compile.");
}

console.info("[nodegit] Determining dependencies.");

return Promise.all([
python(),
getVendorLib("libgit2", "https://github.com/libgit2/libgit2/tarball/" + pkg.libgit2.sha),
getVendorLib("libssh2", pkg.libssh2.url),
getVendorLib("http_parser", pkg.http_parser.url),
guardGenerated()
])
.then(buildNative)
.then(finish, fail);
tar = require("tar");
request = require("request");

console.info("[nodegit] Installing all devDependencies");
return exec("npm install --ignore-scripts --dont-prepublish")
.then(function() {
console.info("[nodegit] Determining source dependencies.");
return Promise.all([
python(),
getVendorLib("libgit2", "https://github.com/libgit2/libgit2/tarball/" + pkg.libgit2.sha),
getVendorLib("libssh2", pkg.libssh2.url),
getVendorLib("http_parser", pkg.http_parser.url),
guardGenerated()
]);
})
.then(buildNative)
.then(finish, fail);
}

function python() {
Expand Down Expand Up @@ -187,11 +194,7 @@ function guardGenerated() {
return Promise.resolve();
}, function() {
console.info("[nodegit] C++ files not found, generating now.");
console.info("[nodegit] Installing all devDependencies");
return exec("npm install --ignore-scripts --dont-prepublish")
.then(function() {
return exec("node generate");
});
return exec("node generate");
});
}

Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@
"dependencies": {
"find-parent-dir": "^0.3.0",
"fs-extra": "^0.12.0",
"nan": "~1.3.0",
"node-gyp": "~1.0.2",
"node-pre-gyp": "~0.5.27",
"nodegit-promise": "~1.0.0",
"nw-gyp": "^0.12.4",
"promisify-node": "~0.1.2",
"request": "~2.45.0",
"tar": "~1.0.1"
"promisify-node": "~0.1.2"
},
"devDependencies": {
"mocha": "~1.21.4",
"combyne": "~0.6.2",
"istanbul": "~0.3.2",
"js-beautify": "^1.5.4",
"jshint": "~2.5.6",
"lodash": "^2.4.1"
"lodash": "^2.4.1",
"nan": "~1.3.0",
"node-gyp": "~1.0.2",
"nw-gyp": "^0.12.4",
"request": "~2.45.0",
"tar": "~1.0.1"
},
"binary": {
"module_name": "nodegit",
Expand Down