@@ -8,9 +8,18 @@ var exec = promisify(function(command, opts, callback) {
88 return require ( "child_process" ) . exec ( command , opts , callback ) ;
99} ) ;
1010
11- var local = path . join . bind ( path , __dirname ) ;
11+ var fromRegistry ;
12+ try {
13+ fs . statSync ( path . join ( __dirname , ".." , "include" ) ) ;
14+ fs . statSync ( path . join ( __dirname , ".." , "src" ) ) ;
15+ fromRegistry = true ;
16+ }
17+ catch ( e ) {
18+ fromRegistry = false ;
19+ }
1220
13- if ( fs . existsSync ( local ( "../.didntcomefromthenpmregistry" ) ) ) {
21+ if ( fromRegistry ) {
22+ console . info ( "[nodegit] Local install, no fetching allowed." ) ;
1423 return prepareAndBuild ( ) ;
1524}
1625if ( process . env . BUILD_DEBUG ) {
@@ -41,14 +50,12 @@ function installPrebuilt() {
4150 ) ;
4251}
4352
44-
4553function pathForTool ( name ) {
4654 var toolPath = path . resolve ( "." , "node_modules" , ".bin" , name ) ;
4755 toolPath = toolPath . replace ( / \s / g, "\\$&" ) ;
4856 return toolPath ;
4957}
5058
51-
5259function prepareAndBuild ( ) {
5360 console . info ( "[nodegit] Regenerating and configuring code" ) ;
5461 return prepareForBuild ( )
@@ -73,8 +80,7 @@ function build() {
7380
7481 opts . env . HOME = path . join ( home , ".nodegit-gyp" ) ;
7582
76- var builder = pathForTool ( "node-gyp" ) ;
77- var cmd = [ builder , "rebuild" , debug ] . join ( " " ) . trim ( ) ;
83+ var cmd = [ pathForTool ( "node-gyp" ) , "rebuild" , debug ] . join ( " " ) . trim ( ) ;
7884
7985 return exec ( cmd , opts )
8086 . then ( function ( ) {
0 commit comments