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

Commit

Permalink
fix(version): return actual js-ipfs version
Browse files Browse the repository at this point in the history
Closes #377
  • Loading branch information
dignifiedquire committed Aug 3, 2016
1 parent 63e284c commit a575c4d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/cli/commands/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
return
}

console.log('ipfs version', version)
console.log(`js-ipfs version: ${version}`)
})
})
}
Expand Down
18 changes: 5 additions & 13 deletions src/core/ipfs/version.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const utils = require('../utils')
const readPkgUp = require('read-pkg-up')

module.exports = function version (self) {
return (opts, callback) => {
Expand All @@ -9,18 +9,10 @@ module.exports = function version (self) {
opts = {}
}

utils.ifRepoExists(self._repo, (err) => {
if (err) {
return callback(err)
}

self._repo.config.get((err, config) => {
if (err) {
return callback(err)
}

callback(null, config.Version.Current)
readPkgUp()
.then((res) => {
callback(null, res.pkg.version)
})
})
.catch(callback)
}
}
4 changes: 2 additions & 2 deletions test/cli/test-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('version', () => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'version'], {env})
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
expect(stdout[0]).to.equal('ipfs version 0.4.0-dev')
expect(stdout[0]).to.equal('js-ipfs version: 0.14.1')
expect(exitcode).to.equal(0)
done()
})
Expand Down Expand Up @@ -46,7 +46,7 @@ describe('version', () => {
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
expect(exitcode).to.equal(0)
expect(stdout[0]).to.equal('ipfs version 0.4.0-dev')
expect(stdout[0]).to.equal('js-ipfs version: 0.14.1')
done()
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/core/both/test-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('version', () => {
it('get version', (done) => {
ipfs.version((err, version) => {
expect(err).to.not.exist
expect(version).to.equal('0.4.0-dev')
expect(version).to.equal('0.14.1')
done()
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/http-api/test-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (httpAPI) => {
method: 'GET',
url: '/api/v0/version'
}, (res) => {
expect(res.result.Version).to.equal('0.4.0-dev')
expect(res.result.Version).to.equal('0.14.1')
expect(res.result).to.have.a.property('Commit')
expect(res.result).to.have.a.property('Repo')
done()
Expand Down

0 comments on commit a575c4d

Please sign in to comment.