From 411134e91042c2e1323028c47120e464c50b37c9 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 31 Jan 2018 20:41:01 -0500 Subject: [PATCH] feat: `ipfs version` flags and `ipfs repo version` (#1199) --- src/core/components/repo.js | 2 +- test/cli/version.js | 37 ++++--------------------------------- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/src/core/components/repo.js b/src/core/components/repo.js index a0216c802d..dc330aba0e 100644 --- a/src/core/components/repo.js +++ b/src/core/components/repo.js @@ -1,7 +1,7 @@ 'use strict' -const repoVersion = require('ipfs-repo').repoVersion const promisify = require('promisify-es6') +const repoVersion = require('ipfs-repo').repoVersion module.exports = function repo (self) { return { diff --git a/test/cli/version.js b/test/cli/version.js index 24b602acd2..5bf740eb15 100644 --- a/test/cli/version.js +++ b/test/cli/version.js @@ -8,18 +8,11 @@ const repoVersion = require('ipfs-repo').repoVersion const pkgversion = require('../../package.json').version const runOnAndOff = require('../utils/on-and-off') -function getRepoVersion (repoPath) { - const versionPath = path.join(repoPath, 'version') - return String(fs.readFileSync(versionPath)) -} - describe('version', () => runOnAndOff((thing) => { let ipfs - let repoVersion before(() => { ipfs = thing.ipfs - repoVersion = getRepoVersion(ipfs.repoPath) }) it('get the version', () => @@ -68,31 +61,9 @@ describe('version', () => runOnAndOff((thing) => { ) }) - it('handles --number', () => { - return ipfs('version --number').then(out => - expect(out).to.eql(`${pkgversion}\n`) - ) - }) - - it('handles --commit', () => { - return ipfs('version --commit').then(out => - expect(out).to.eql(`js-ipfs version: ${pkgversion}-\n`) - ) - }) - - it('handles --all', () => { - return ipfs('version --all').then(out => - expect(out).to.include( - `js-ipfs version: ${pkgversion}- -Repo version: ${repoVersion} -` - ) - ) - }) - - it('handles --repo', () => { - return ipfs('version --repo').then(out => { + it('handles --repo', () => + ipfs('version --repo').then(out => expect(out).to.eql(`${repoVersion}\n`) - }) - }) + ) + ) }))