11var os = require ( "os" ) ;
22var path = require ( "path" ) ;
33var zlib = require ( "zlib" ) ;
4- var tar = require ( "tar" ) ;
4+ var tar ;
5+ var request ;
56
67var Promise = require ( "nodegit-promise" ) ;
78var promisify = require ( "promisify-node" ) ;
8- var request = require ( "request" ) ;
99var fse = promisify ( require ( "fs-extra" ) ) ;
1010var findParentDir = promisify ( require ( 'find-parent-dir' ) ) ;
1111fse . ensureDir = promisify ( fse . ensureDir , function ( ) { return true ; } ) ;
@@ -14,6 +14,7 @@ var exec = promisify(function(command, opts, callback) {
1414 return require ( "child_process" ) . exec ( command , opts , callback ) ;
1515} ) ;
1616
17+
1718var NODE_VERSION = Number ( process . version . match ( / ^ v ( \d + \. \d + ) / ) [ 1 ] ) ;
1819
1920// If the build only flag is set.
@@ -96,17 +97,23 @@ function compile(err) {
9697 console . info ( "[nodegit] Failed to install prebuilt, attempting compile." ) ;
9798 }
9899
99- console . info ( "[nodegit] Determining dependencies." ) ;
100-
101- return Promise . all ( [
102- python ( ) ,
103- getVendorLib ( "libgit2" , "https://github.com/libgit2/libgit2/tarball/" + pkg . libgit2 . sha ) ,
104- getVendorLib ( "libssh2" , pkg . libssh2 . url ) ,
105- getVendorLib ( "http_parser" , pkg . http_parser . url ) ,
106- guardGenerated ( )
107- ] )
108- . then ( buildNative )
109- . then ( finish , fail ) ;
100+ tar = require ( "tar" ) ;
101+ request = require ( "request" ) ;
102+
103+ console . info ( "[nodegit] Installing all devDependencies" ) ;
104+ return exec ( "npm install --ignore-scripts --dont-prepublish" )
105+ . then ( function ( ) {
106+ console . info ( "[nodegit] Determining source dependencies." ) ;
107+ return Promise . all ( [
108+ python ( ) ,
109+ getVendorLib ( "libgit2" , "https://github.com/libgit2/libgit2/tarball/" + pkg . libgit2 . sha ) ,
110+ getVendorLib ( "libssh2" , pkg . libssh2 . url ) ,
111+ getVendorLib ( "http_parser" , pkg . http_parser . url ) ,
112+ guardGenerated ( )
113+ ] ) ;
114+ } )
115+ . then ( buildNative )
116+ . then ( finish , fail ) ;
110117}
111118
112119function python ( ) {
@@ -187,11 +194,7 @@ function guardGenerated() {
187194 return Promise . resolve ( ) ;
188195 } , function ( ) {
189196 console . info ( "[nodegit] C++ files not found, generating now." ) ;
190- console . info ( "[nodegit] Installing all devDependencies" ) ;
191- return exec ( "npm install --ignore-scripts --dont-prepublish" )
192- . then ( function ( ) {
193- return exec ( "node generate" ) ;
194- } ) ;
197+ return exec ( "node generate" ) ;
195198 } ) ;
196199}
197200
0 commit comments