node-git-server
Advanced tools
Comparing version
@@ -0,1 +1,7 @@ | ||
# 0.5.1 (03/03/2019) | ||
- bump dependencies | ||
- tap `^11.0.1` -> `^12.5.3` | ||
- tryitout `^2.0.6` -> `^2.1.1` | ||
# 0.5.0 (11/27/2018) | ||
@@ -2,0 +8,0 @@ |
@@ -436,2 +436,3 @@ const fs = require('fs'); | ||
* @param {Function} callback - the function to call when server is started or error has occured | ||
* @return {Git} - the Git instance, useful for chaining | ||
*/ | ||
@@ -451,2 +452,3 @@ listen(port, options, callback) { | ||
this.server.listen(port, callback); | ||
return this; | ||
} | ||
@@ -457,5 +459,10 @@ /** | ||
* @memberof Git | ||
* @param {Promise} - will resolve or reject when the server closes or fails to close. | ||
*/ | ||
close() { | ||
this.server.close(); | ||
close(callback) { | ||
return new Promise((resolve, reject) => { | ||
this.server.close((err) => { | ||
err ? reject(err) : resolve(); | ||
}); | ||
}); | ||
} | ||
@@ -462,0 +469,0 @@ } |
@@ -61,3 +61,3 @@ const through = require('through'); | ||
if (tokens[0] === "Basic") { | ||
const splitHash = new Buffer.from(tokens[1], 'base64').toString('utf8').split(":"); | ||
const splitHash = Buffer.from(tokens[1], 'base64').toString('utf8').split(":"); | ||
this.username = splitHash.shift(); | ||
@@ -145,3 +145,3 @@ } | ||
self.emit('response', respStream, function endResponse() { | ||
res.queue(new Buffer.from('0000')); | ||
res.queue(Buffer.from('0000')); | ||
res.queue(null); | ||
@@ -148,0 +148,0 @@ }); |
@@ -37,3 +37,3 @@ /** | ||
if (tokens[0] === "Basic") { | ||
const splitHash = new Buffer.from(tokens[1], 'base64').toString('utf8').split(":"); | ||
const splitHash = Buffer.from(tokens[1], 'base64').toString('utf8').split(":"); | ||
const username = splitHash.shift(); | ||
@@ -40,0 +40,0 @@ const password = splitHash.join(":"); |
{ | ||
"name": "node-git-server", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "🎡 A configurable git server written in Node.js", | ||
@@ -39,6 +39,6 @@ "author": "Gabriel J. Csapo <gabecsapo@gmail.com>", | ||
"jsdoc": "^3.5.5", | ||
"tap": "^11.0.1", | ||
"tap": "^12.5.3", | ||
"tape": "^4.8.0", | ||
"tryitout": "^2.0.6" | ||
"tryitout": "^2.1.1" | ||
} | ||
} |
@@ -13,3 +13,3 @@ const test = require('tape'); | ||
test('git', (t) => { | ||
t.plan(8); | ||
t.plan(9); | ||
@@ -608,3 +608,3 @@ t.test('create, push to, and clone a repo', (t) => { | ||
const port = Math.floor(Math.random() * ((1 << 16) - 1e4)) + 1e4; | ||
repos.listen(port); | ||
t.equal(repos.listen(port), repos); | ||
@@ -628,2 +628,16 @@ process.chdir(srcDir); | ||
t.test('should return promise that resolves when server is closed if no callback specified', (t) => { | ||
const repoDir = `/tmp/${Math.floor(Math.random() * (1 << 30)).toString(16)}`; | ||
fs.mkdirSync(repoDir, 0700); | ||
const repos = new GitServer(repoDir); | ||
const port = Math.floor(Math.random() * ((1 << 16) - 1e4)) + 1e4; | ||
repos.listen(port, () => { | ||
repos.close().then(() => { | ||
t.end(); | ||
}); | ||
}); | ||
}); | ||
t.test('should be able to protect certain routes', (t) => { | ||
@@ -630,0 +644,0 @@ const repoDir = `/tmp/${Math.floor(Math.random() * (1 << 30)).toString(16)}`; |
622566
0.14%3093
0.59%