Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: ipfs version flags and ipfs repo version (#1199)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonKrone committed Feb 16, 2018
1 parent fe602f0 commit 411134e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/core/components/repo.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
37 changes: 4 additions & 33 deletions test/cli/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () =>
Expand Down Expand Up @@ -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`)
})
})
)
)
}))

0 comments on commit 411134e

Please sign in to comment.