Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
1 change: 1 addition & 0 deletions 1 lifecycleScripts/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ npm.load({

var modulesToPrune = [
"for-node-webkit",
"which-native-nodish",
"fs-extra",
"node-pre-gyp",
"npm"
Expand Down
57 changes: 40 additions & 17 deletions 57 lifecycleScripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,28 @@ var fs = require("fs");
var local = path.join.bind(path, __dirname);

var checkPrepared = require(local("checkPrepared"));
var forNodeWebkit = require("for-node-webkit");
var whichNativeNodish = require("which-native-nodish");
var prepareForBuild = require(local("prepareForBuild"));

var exec = promisify(function(command, opts, callback) {
return require("child_process").exec(command, opts, callback);
});
var nwVersion = null;
var asVersion = null;

return forNodeWebkit(local(".."))
return whichNativeNodish(local(".."))
.then(function(results) {
return results.nwVersion;
nwVersion = results.nwVersion;
asVersion = results.asVersion;
})
.then(function(nodeWebkitVersion) {
if (nodeWebkitVersion) {
console.info("[nodegit] Must build for node-webkit");
return checkAndBuild(nodeWebkitVersion);
.then(function() {
if (nwVersion) {
console.info("[nodegit] Must build for node-webkit/nw.js");
return checkAndBuild();
}
else if (asVersion) {
console.info("[nodegit] Must build for atom-shell");
return checkAndBuild();
}
if (fs.existsSync(local("../.didntcomefromthenpmregistry"))) {
return checkAndBuild();
Expand Down Expand Up @@ -48,7 +55,7 @@ return forNodeWebkit(local(".."))
});


function checkAndBuild(nwVersion) {
function checkAndBuild() {
console.info("[nodegit] Making sure dependencies are available and native " +
"code is generated");

Expand All @@ -64,11 +71,11 @@ function checkAndBuild(nwVersion) {
}
})
.then(function() {
return build(nwVersion);
return build();
});
}

function build(nwVersion) {
function build() {
console.info("[nodegit] Everything is ready to go, attempting compilation");
if (nwVersion) {
console.info("[nodegit] Building native node-webkit module.");
Expand All @@ -82,14 +89,30 @@ function build(nwVersion) {
maxBuffer: Number.MAX_VALUE
};

var builder = nwVersion ? "nw-gyp" : "node-gyp";
var target = (nwVersion ? "--target=\"" + nwVersion + "\"": "");
var prefix = "";
var target = "";
var debug = (process.env.BUILD_DEBUG ? " --debug" : "");
var cmd = path.resolve(".", "node_modules", ".bin", builder) +
" clean configure" +
debug +
target +
" build";
var builder = "node-gyp";
var distUrl = "";

if (asVersion) {
prefix = (process.platform == "win32" ?
"SET HOME=\"~/.atom-shell-gyp\" && " :
"HOME=~/.atom-shell-gyp");

target = "--target=" + asVersion;

distUrl = "--dist-url=https://gh-contractor-zcbenz.s3." +
"amazonaws.com/atom-shell/dist";
}
else if (nwVersion) {
builder = "nw-gyp";
target = "--target=" + nwVersion;
}

builder = path.resolve(".", "node_modules", ".bin", builder);
var cmd = [prefix, builder, "rebuild", target, debug, distUrl]
.join(" ").trim();

return exec(cmd, opts)
.then(function() {
Expand Down
4 changes: 2 additions & 2 deletions 4 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
"node-pre-gyp"
],
"dependencies": {
"for-node-webkit": "0.0.2",
"fs-extra": "~0.15.0",
"node-pre-gyp": "~0.6.1",
"nodegit-promise": "~1.0.0",
"npm": "^2.1.18",
"promisify-node": "~0.1.2"
"promisify-node": "~0.1.2",
"which-native-nodish": "^1.0.3"
},
"devDependencies": {
"mocha": "~2.1.0",
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.