This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
123 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
'use strict' | ||
|
||
const boom = require('boom') | ||
|
||
exports = module.exports | ||
|
||
exports.version = (request, reply) => { | ||
const ipfs = request.server.app.ipfs | ||
|
||
ipfs.repo.version((err, version) => { | ||
if (err) { | ||
return reply(boom.badRequest(err)) | ||
} | ||
|
||
reply(version) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const fs = require('fs') | ||
const path = require('path') | ||
const expect = require('chai').expect | ||
const runOnAndOff = require('../utils/on-and-off') | ||
|
||
function getRepoVersion (repoPath) { | ||
const versionPath = path.join(repoPath, 'version') | ||
return String(fs.readFileSync(versionPath)) | ||
} | ||
|
||
describe('repo', () => runOnAndOff((thing) => { | ||
let ipfs | ||
let repoVersion | ||
|
||
before(() => { | ||
ipfs = thing.ipfs | ||
repoVersion = getRepoVersion(ipfs.repoPath) | ||
}) | ||
|
||
it('get the repo version', () => { | ||
return ipfs('repo version').then((out) => { | ||
expect(out).to.eql(`${repoVersion}\n`) | ||
}) | ||
}) | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters