| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,7 @@ | |||
| 12 | 12 | .jshintrc | |
| 13 | 13 | .travis.yml | |
| 14 | 14 | .appveyor.yml | |
| 15 | + .didntcomefromthenpmregistry | ||
| 15 | 16 | ||
| 16 | 17 | *.vcxproj | |
| 17 | 18 | *.filters | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,57 @@ | |||
| 1 | + var Promise = require("nodegit-promise"); | ||
| 2 | + var path = require("path"); | ||
| 3 | + var fs = require("fs"); | ||
| 4 | + var rooted = path.join.bind(path, __dirname, ".."); | ||
| 5 | + var pkg = require(rooted("package")); | ||
| 6 | + | ||
| 7 | + module.exports.checkAll = function checkAll() { | ||
| 8 | + return Promise.all([ | ||
| 9 | + checkVendor("libgit2"), | ||
| 10 | + checkVendor("libssh2"), | ||
| 11 | + checkVendor("http_parser"), | ||
| 12 | + | ||
| 13 | + checkExists("lib/nodegit.js"), | ||
| 14 | + checkExists("lib/enums.js"), | ||
| 15 | + checkExists("src"), | ||
| 16 | + checkExists("include") | ||
| 17 | + ]).then(function(checks) { | ||
| 18 | + return checks.reduce(function(soFar, currentCheck) { | ||
| 19 | + return soFar && currentCheck; | ||
| 20 | + }, true); | ||
| 21 | + }); | ||
| 22 | + }; | ||
| 23 | + | ||
| 24 | + function checkExists(name) { | ||
| 25 | + return new Promise(function(resolve, reject) { | ||
| 26 | + fs.exists(rooted(name), function(exists) { | ||
| 27 | + resolve(exists); | ||
| 28 | + }); | ||
| 29 | + }); | ||
| 30 | + } | ||
| 31 | + module.exports.checkExists = checkExists; | ||
| 32 | + | ||
| 33 | + function checkVendor(name, skipVersion) { | ||
| 34 | + var version = skipVersion ? "" : (pkg[name].sha || pkg[name].version); | ||
| 35 | + var vendorPath = "vendor/" + name + "/" + version; | ||
| 36 | + return checkExists(vendorPath); | ||
| 37 | + } | ||
| 38 | + module.exports.checkVendor = checkVendor | ||
| 39 | + | ||
| 40 | + function checkGenerated() { | ||
| 41 | + return Promise.all([ | ||
| 42 | + checkExists("lib/nodegit.js"), | ||
| 43 | + checkExists("lib/enums.js"), | ||
| 44 | + checkExists("src"), | ||
| 45 | + checkExists("include") | ||
| 46 | + ]).then(function(checks) { | ||
| 47 | + return checks.reduce(function(soFar, currentCheck) { | ||
| 48 | + return soFar && currentCheck; | ||
| 49 | + }, true); | ||
| 50 | + }); | ||
| 51 | + } | ||
| 52 | + module.exports.checkGenerated = checkGenerated; | ||
| 53 | + | ||
| 54 | + // Called on the command line | ||
| 55 | + if (require.main === module) { | ||
| 56 | + module.exports.checkAll(); | ||
| 57 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments