@@ -19,14 +19,6 @@ return whichNativeNodish("..")
1919 asVersion = results . asVersion ;
2020 } )
2121 . then ( function ( ) {
22- if ( nwVersion ) {
23- console . info ( "[nodegit] Must build for node-webkit/nw.js" ) ;
24- return prepareAndBuild ( ) ;
25- }
26- else if ( asVersion ) {
27- console . info ( "[nodegit] Must build for atom-shell" ) ;
28- return prepareAndBuild ( ) ;
29- }
3022 if ( fs . existsSync ( local ( "../.didntcomefromthenpmregistry" ) ) ) {
3123 return prepareAndBuild ( ) ;
3224 }
@@ -38,21 +30,34 @@ return whichNativeNodish("..")
3830 console . info ( "[nodegit] BUILD_ONLY is set to true, no fetching allowed." ) ;
3931 return prepareAndBuild ( ) ;
4032 }
41- console . info ( "[nodegit] Fetching binary from S3." ) ;
42- return exec ( "node-pre-gyp install" )
43- . then (
44- function ( ) {
45- console . info ( "[nodegit] Completed installation successfully." ) ;
46- } ,
47- function ( err ) {
48- console . info ( "[nodegit] Failed to install prebuilt binary, " +
49- "building manually." ) ;
50- console . error ( err ) ;
51- return prepareAndBuild ( ) ;
52- }
53- ) ;
33+ var args = [ ] ;
34+ if ( asVersion ) {
35+ args . push ( "--runtime=electron" ) ;
36+ args . push ( "--target=" + asVersion ) ;
37+ } else if ( nwVersion ) {
38+ args . push ( "--runtime=node-webkit" ) ;
39+ args . push ( "--target=" + nwVersion ) ;
40+ }
41+ return installPrebuilt ( args ) ;
5442 } ) ;
5543
44+ function installPrebuilt ( args ) {
45+ console . info ( "[nodegit] Fetching binary from S3." ) ;
46+ var installArguments = args . join ( " " ) ;
47+ return exec ( "node-pre-gyp install " + installArguments )
48+ . then (
49+ function ( ) {
50+ console . info ( "[nodegit] Completed installation successfully." ) ;
51+ } ,
52+ function ( err ) {
53+ console . info ( "[nodegit] Failed to install prebuilt binary, " +
54+ "building manually." ) ;
55+ console . error ( err ) ;
56+ return prepareAndBuild ( ) ;
57+ }
58+ ) ;
59+ }
60+
5661
5762function prepareAndBuild ( ) {
5863 console . info ( "[nodegit] Regenerating and configuring code" ) ;
0 commit comments