@@ -2,50 +2,31 @@ var promisify = require("promisify-node");
22var path = require ( "path" ) ;
33var fs = require ( "fs" ) ;
44
5- var whichNativeNodish = require ( "which-native-nodish" ) ;
65var prepareForBuild = require ( "./prepareForBuild" ) ;
76
87var exec = promisify ( function ( command , opts , callback ) {
98 return require ( "child_process" ) . exec ( command , opts , callback ) ;
109} ) ;
11- var nwVersion = null ;
12- var asVersion = null ;
1310
1411var local = path . join . bind ( path , __dirname ) ;
1512
16- return whichNativeNodish ( ".." )
17- . then ( function ( results ) {
18- nwVersion = results . nwVersion ;
19- asVersion = results . asVersion ;
20- } )
21- . then ( function ( ) {
22- if ( fs . existsSync ( local ( "../.didntcomefromthenpmregistry" ) ) ) {
23- return prepareAndBuild ( ) ;
24- }
25- if ( process . env . BUILD_DEBUG ) {
26- console . info ( "[nodegit] Doing a debug build, no fetching allowed." ) ;
27- return prepareAndBuild ( ) ;
28- }
29- if ( process . env . BUILD_ONLY ) {
30- console . info ( "[nodegit] BUILD_ONLY is set to true, no fetching allowed." ) ;
31- return prepareAndBuild ( ) ;
32- }
33- var args = [ ] ;
34- if ( asVersion ) {
35- args . push ( "--runtime=electron" ) ;
36- args . push ( "--target=" + asVersion ) ;
37- args . push ( "--is_clang=1" ) ;
38- } else if ( nwVersion ) {
39- args . push ( "--runtime=node-webkit" ) ;
40- args . push ( "--target=" + nwVersion ) ;
41- }
42- return installPrebuilt ( args ) ;
43- } ) ;
13+ if ( fs . existsSync ( local ( "../.didntcomefromthenpmregistry" ) ) ) {
14+ return prepareAndBuild ( ) ;
15+ }
16+ if ( process . env . BUILD_DEBUG ) {
17+ console . info ( "[nodegit] Doing a debug build, no fetching allowed." ) ;
18+ return prepareAndBuild ( ) ;
19+ }
20+ if ( process . env . BUILD_ONLY ) {
21+ console . info ( "[nodegit] BUILD_ONLY is set to true, no fetching allowed." ) ;
22+ return prepareAndBuild ( ) ;
23+ }
4424
45- function installPrebuilt ( args ) {
25+ return installPrebuilt ( ) ;
26+
27+ function installPrebuilt ( ) {
4628 console . info ( "[nodegit] Fetching binary from S3." ) ;
47- var installArguments = args . join ( " " ) ;
48- return exec ( "node-pre-gyp install " + installArguments )
29+ return exec ( "node-pre-gyp install --fallback-to-build=false" )
4930 . then (
5031 function ( ) {
5132 console . info ( "[nodegit] Completed installation successfully." ) ;
@@ -70,44 +51,24 @@ function prepareAndBuild() {
7051
7152function build ( ) {
7253 console . info ( "[nodegit] Everything is ready to go, attempting compilation" ) ;
73- if ( nwVersion ) {
74- console . info ( "[nodegit] Building native node-webkit module." ) ;
75- }
76- else {
77- console . info ( "[nodegit] Building native node module." ) ;
78- }
7954
8055 var opts = {
8156 cwd : "." ,
8257 maxBuffer : Number . MAX_VALUE ,
8358 env : process . env
8459 } ;
8560
86- var target = "" ;
8761 var debug = ( process . env . BUILD_DEBUG ? " --debug" : "" ) ;
8862 var builder = "node-gyp" ;
89- var distUrl = "" ;
90-
91- if ( asVersion ) {
92- var home = process . platform == "win32" ?
93- process . env . USERPROFILE : process . env . HOME ;
94-
95- opts . env . HOME = path . join ( home , ".atom-shell-gyp" ) ;
9663
97- target = "--target=" + asVersion ;
64+ var home = process . platform == "win32" ?
65+ process . env . USERPROFILE : process . env . HOME ;
9866
99- distUrl = "--dist-url=https://gh-contractor-zcbenz.s3." +
100- "amazonaws.com/atom-shell/dist" ;
101- }
102- else if ( nwVersion ) {
103- builder = "nw-gyp" ;
104- target = "--target=" + nwVersion ;
105- }
67+ opts . env . HOME = path . join ( home , ".nodegit-gyp" ) ;
10668
10769 builder = path . resolve ( "." , "node_modules" , ".bin" , builder ) ;
10870 builder = builder . replace ( / \s / g, "\\$&" ) ;
109- var cmd = [ builder , "rebuild" , target , debug , distUrl ]
110- . join ( " " ) . trim ( ) ;
71+ var cmd = [ builder , "rebuild" , debug ] . join ( " " ) . trim ( ) ;
11172
11273 return exec ( cmd , opts )
11374 . then ( function ( ) {
0 commit comments