| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,9 @@ | |||
| 1 | 1 | /build/* | |
| 2 | 2 | !/build/codegen/ | |
| 3 | - /node_modules/ | ||
| 4 | - /vendor/libgit2/ | ||
| 3 | + | ||
| 5 | 4 | /doc/* | |
| 6 | 5 | !/doc/Theme.css | |
| 7 | - /test/.reposCache | ||
| 6 | + | ||
| 7 | + /node_modules/ | ||
| 8 | + /vendor/libgit2/ | ||
| 9 | + /test/repos/ | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,7 +45,6 @@ | |||
| 45 | 45 | "nodeunit": "~0.8.6", | |
| 46 | 46 | "rimraf": "~2.2.6", | |
| 47 | 47 | "ejs": "~1.0.0", | |
| 48 | - "ncp": "~0.5.0", | ||
| 49 | 48 | "async": "~0.2.10" | |
| 50 | 49 | }, | |
| 51 | 50 | "scripts": { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,45 +1,40 @@ | |||
| 1 | 1 | var fs = require('fs'); | |
| 2 | 2 | var rimraf = require('rimraf'); | |
| 3 | - var ncp = require('ncp').ncp; | ||
| 4 | 3 | var exec = require('child_process').exec; | |
| 5 | 4 | var path = require('path'); | |
| 6 | 5 | var async = require('async'); | |
| 7 | 6 | ||
| 8 | 7 | var testFiles = ['blob','difflist','oid','repo','tree_entry','commit','reference','revwalk','tree']; | |
| 9 | 8 | ||
| 10 | 9 | function setupReposCache(cb) { | |
| 11 | - fs.mkdir('.reposCache',function() { | ||
| 12 | - async.series([ | ||
| 13 | - function empty(cb) { exec('git init .reposCache/empty',cb); }, | ||
| 14 | - function workdir(cb) { exec('git clone https://github.com/nodegit/nodegit.git .reposCache/workdir',cb); }, | ||
| 15 | - function nonrepo(cb) { | ||
| 16 | - fs.mkdir('.reposCache/nonrepo',function() { | ||
| 17 | - fs.writeFile('.reposCache/nonrepo/file.txt','This is a bogus file',cb); | ||
| 18 | - }); | ||
| 19 | - } | ||
| 20 | - ],cb); | ||
| 21 | - }); | ||
| 10 | + fs.mkdir('repos',function() { | ||
| 11 | + async.series([ | ||
| 12 | + function empty(cb) { exec('git init repos/empty',function() { cb(); }); }, | ||
| 13 | + function workdir(cb) { exec('git clone https://github.com/nodegit/nodegit.git repos/workdir',function() { cb(); }); }, | ||
| 14 | + function nonrepo(cb) { | ||
| 15 | + fs.mkdir('repos/nonrepo',function() { | ||
| 16 | + fs.writeFile('repos/nonrepo/file.txt','This is a bogus file',function() { | ||
| 17 | + cb(); | ||
| 18 | + }); | ||
| 19 | + }); | ||
| 20 | + } | ||
| 21 | + ],function() { | ||
| 22 | + cb(); | ||
| 23 | + }); | ||
| 24 | + }); | ||
| 22 | 25 | } | |
| 23 | 26 | ||
| 24 | - module.exports = { | ||
| 25 | - setUp: function(cb) { | ||
| 26 | - fs.exists('.reposCache',function(exists) { | ||
| 27 | - if (exists) { | ||
| 28 | - ncp('.reposCache','repos',cb); | ||
| 29 | - } else { | ||
| 30 | - setupReposCache(function(err) { | ||
| 31 | - if (err) { return cb(err); } | ||
| 32 | - ncp('.reposCache','repos',cb); | ||
| 33 | - }); | ||
| 34 | - } | ||
| 35 | - }); | ||
| 36 | - }, | ||
| 37 | - tearDown: function(cb) { | ||
| 38 | - rimraf('repos',cb); | ||
| 39 | - } | ||
| 27 | + exports.setUp = function(cb) { | ||
| 28 | + fs.exists('.reposCache', function(exists) { | ||
| 29 | + if (!exists) { | ||
| 30 | + setupReposCache(function(err) { | ||
| 31 | + cb(); | ||
| 32 | + }); | ||
| 33 | + } | ||
| 34 | + }); | ||
| 40 | 35 | }; | |
| 41 | 36 | ||
| 42 | - for(var i in testFiles) { | ||
| 43 | - var testFile = testFiles[i]; | ||
| 44 | - module.exports[testFile] = require('./'+testFile); | ||
| 45 | - } | ||
| 37 | + Object.keys(testFiles).forEach(function(fileName) { | ||
| 38 | + var testFile = testFiles[fileName] | ||
| 39 | + exports[testFile] = require('./' + testFile); | ||
| 40 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | var git = require('../'), | |
| 2 | 2 | rimraf = require('rimraf'), | |
| 3 | - fs = require('fs'); | ||
| 3 | + fs = require('fs'), | ||
| 4 | + path = require('path'); | ||
| 4 | 5 | ||
| 5 | 6 | var sha = '5716e9757886eaf38d51c86b192258c960d9cfea'; | |
| 6 | 7 | var fileCount = 512; // Number of blob & blob executabless | |
@@ -36,7 +37,7 @@ exports.insert = function(test) { | |||
| 36 | 37 | buffer = new Buffer(text); | |
| 37 | 38 | repo.createBlobFromBuffer(buffer, function(error, blobId) { | |
| 38 | 39 | var builder = tree.builder(); | |
| 39 | - builder.insert("lib/baz/bar.txt", blobId, git.TreeEntry.FileMode.Blob); | ||
| 40 | + builder.insert(path.join("lib", "baz", "bar.txt"), blobId, git.TreeEntry.FileMode.Blob); | ||
| 40 | 41 | builder.write(function(error, treeId) { | |
| 41 | 42 | repo.getTree(treeId, function(error, tree) { | |
| 42 | 43 | var author = git.Signature.create("Scott Chacon", "schacon@gmail.com", 123456789, 60), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments