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

Commit

Permalink
Update to standard 6
Browse files Browse the repository at this point in the history
  • Loading branch information
fbaiodias committed Mar 4, 2016
1 parent e8dd778 commit 45fb69c
Show file tree
Hide file tree
Showing 31 changed files with 74 additions and 73 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"main": "src/index.js",
"scripts": {
"lint": "standard",
"lint": "standard --verbose | snazzy",
"coverage": "istanbul cover --print both -- _mocha tests/test-core/index.js",
"coverage:http-api": "istanbul cover --print both -- _mocha tests/test-http-api/index.js",
"test": "npm run test:node && npm run test:browser",
Expand Down Expand Up @@ -61,7 +61,8 @@
"nexpect": "^0.5.0",
"pre-commit": "^1.1.2",
"rimraf": "^2.4.4",
"standard": "^5.4.1",
"snazzy": "^3.0.0",
"standard": "^6.0.7",
"stream-to-promise": "^1.1.0",
"transform-loader": "^0.2.3",
"webpack": "^2.0.7-beta"
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const Command = require('ronin').Command
module.exports = Command.extend({
desc: '',

run: name => {
run: (name) => {
}
})
2 changes: 1 addition & 1 deletion src/cli/commands/bootstrap/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = Command.extend({
var node = new IPFS()
node.bootstrap.list((err, list) => {
if (err) { return log.error(err) }
list.forEach(node => {
list.forEach((node) => {
console.log(node)
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const ronin = require('ronin')
module.exports = Command.extend({
desc: '',

run: name => {
run: (name) => {
const cli = ronin(path.resolve(__dirname, '..'))

cli.setupCommands()
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ log.error = debug('cli:daemon:error')
module.exports = Command.extend({
desc: 'Start a long-running daemon process',

run: name => {
run: (name) => {
console.log('Initializing daemon...')
httpAPI.start((err) => {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const Command = require('ronin').Command
module.exports = Command.extend({
desc: '',

run: name => {
run: (name) => {
}
})
2 changes: 1 addition & 1 deletion src/cli/commands/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ const Command = require('ronin').Command
module.exports = Command.extend({
desc: '',

run: name => {
run: (name) => {
}
})
2 changes: 1 addition & 1 deletion src/cli/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ module.exports = Command.extend({
}
},

run: name => {
run: (name) => {
}
})
2 changes: 1 addition & 1 deletion src/cli/commands/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const Command = require('ronin').Command
module.exports = Command.extend({
desc: '',

run: name => {
run: (name) => {
}
})
2 changes: 1 addition & 1 deletion src/cli/commands/mount.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const Command = require('ronin').Command
module.exports = Command.extend({
desc: '',

run: name => {
run: (name) => {
}
})
2 changes: 1 addition & 1 deletion src/cli/commands/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const Command = require('ronin').Command
module.exports = Command.extend({
desc: '',

run: name => {
run: (name) => {
}
})
2 changes: 1 addition & 1 deletion src/cli/commands/refs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const Command = require('ronin').Command
module.exports = Command.extend({
desc: '',

run: name => {
run: (name) => {
}
})
2 changes: 1 addition & 1 deletion src/cli/commands/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const Command = require('ronin').Command
module.exports = Command.extend({
desc: '',

run: name => {
run: (name) => {
}
})
2 changes: 1 addition & 1 deletion src/cli/commands/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const Command = require('ronin').Command
module.exports = Command.extend({
desc: '',

run: name => {
run: (name) => {
}
})
2 changes: 1 addition & 1 deletion src/http-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ exports.start = (callback) => {
})
}

exports.stop = callback => {
exports.stop = (callback) => {
const repoPath = process.env.IPFS_PATH || os.homedir() + '/.ipfs'
fs.unlinkSync(repoPath + '/api')
exports.server.stop(callback)
Expand Down
6 changes: 3 additions & 3 deletions src/ipfs-core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function IPFS (repo) {
repo.config.get((err, config) => {
if (err) { return callback(err) }
config.Bootstrap.push(multiaddr)
repo.config.set(config, err => {
repo.config.set(config, (err) => {
if (err) { return callback(err) }

callback()
Expand All @@ -105,7 +105,7 @@ function IPFS (repo) {
rm: (multiaddr, callback) => {
repo.config.get((err, config) => {
if (err) { return callback(err) }
config.Bootstrap = config.Bootstrap.filter(mh => {
config.Bootstrap = config.Bootstrap.filter((mh) => {
if (mh === multiaddr) {
return false
} else { return true }
Expand All @@ -124,7 +124,7 @@ function IPFS (repo) {
replace: (config, callback) => {
repo.config.set(config, callback)
},
show: callback => {
show: (callback) => {
repo.config.get((err, config) => {
if (err) { return callback(err) }
callback(null, config)
Expand Down
12 changes: 6 additions & 6 deletions tests/test-cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ describe('cli', () => {
const repoExample = process.cwd() + '/tests/repo-example'
const repoTests = exports.repoTests = process.cwd() + '/tests/repo-tests-run'

before(done => {
ncp(repoExample, repoTests, err => {
before((done) => {
ncp(repoExample, repoTests, (err) => {
process.env.IPFS_PATH = repoTests
expect(err).to.equal(null)
done()
})
})

after(done => {
rimraf(repoTests, err => {
after((done) => {
rimraf(repoTests, (err) => {
expect(err).to.equal(null)
done()
})
})

const tests = fs.readdirSync(__dirname)
tests.filter(file => {
tests.filter((file) => {
if (file === 'index.js' || file === 'api.js') {
return false
} else {
return true
}
}).forEach(file => {
}).forEach((file) => {
require('./' + file)
})
})
6 changes: 3 additions & 3 deletions tests/test-cli/test-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('id', () => {
'/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT'
]

it('list the bootstrap nodes', done => {
it('list the bootstrap nodes', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'bootstrap', 'list'])
.run((err, stdout, exitcode) => {
expect(stdout).to.deep.equal(defaultList)
Expand All @@ -40,7 +40,7 @@ describe('id', () => {
})
})

it('add another bootstrap node', done => {
it('add another bootstrap node', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'bootstrap', 'add', '/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT'])
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
Expand All @@ -56,7 +56,7 @@ describe('id', () => {
})
})

it('rm a bootstrap node', done => {
it('rm a bootstrap node', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'bootstrap', 'rm', '/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT'])
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
Expand Down
14 changes: 7 additions & 7 deletions tests/test-cli/test-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('config', () => {

const updatedConfig = () => JSON.parse(fs.readFileSync(configPath, 'utf8'))

it('get a config key value', done => {
it('get a config key value', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'Identity.PeerID'])
.run((err, stdout, exitcode) => {
const expected = 'QmQ2zigjQikYnyYUSXZydNXrDRhBut2mubwJBaLXobMt3A'
Expand All @@ -22,7 +22,7 @@ describe('config', () => {
})
})

it('set a config key with a string value', done => {
it('set a config key with a string value', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'foo', 'bar'])
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
Expand All @@ -32,7 +32,7 @@ describe('config', () => {
})
})

it('set a config key with true', done => {
it('set a config key with true', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'foo', true, '--bool'])
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
Expand All @@ -42,7 +42,7 @@ describe('config', () => {
})
})

it('set a config key with false', done => {
it('set a config key with false', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'foo', false, '--bool'])
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
Expand All @@ -52,7 +52,7 @@ describe('config', () => {
})
})

it('set a config key with json', done => {
it('set a config key with json', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'foo', '{"bar": 0}', '--json'])
.run((err, stdout, exitcode) => {
expect(err).to.not.exist
Expand All @@ -62,7 +62,7 @@ describe('config', () => {
})
})

it('set a config key with invalid json', done => {
it('set a config key with invalid json', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config', 'foo', '{"bar: 0}', '--json'])
.run((err, stdout, exitcode) => {
const expected = 'error\tinvalid JSON provided'
Expand All @@ -73,7 +73,7 @@ describe('config', () => {
})
})

it('call config with no arguments', done => {
it('call config with no arguments', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'config'])
.run((err, stdout, exitcode) => {
const expected = "error\targument 'key' is required"
Expand Down
2 changes: 1 addition & 1 deletion tests/test-cli/test-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('id', () => {
})
})

it('get the id', done => {
it('get the id', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'id'])
.run((err, stdout, exitcode) => {
var expected = [ "{ ID: 'QmQ2zigjQikYnyYUSXZydNXrDRhBut2mubwJBaLXobMt3A',",
Expand Down
2 changes: 1 addition & 1 deletion tests/test-cli/test-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const nexpect = require('nexpect')

describe('version', () => {
describe('api offline', () => {
it('get the version', done => {
it('get the version', (done) => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'version'])
.expect('0.4.0-dev')
.run((err, stdout, exitcode) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/test-core/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ describe('IPFS Repo Tests on the Browser', function () {
const testsContext = require.context('.', true, /test-*/)
testsContext
.keys()
.forEach(key => testsContext(key))
.forEach((key) => testsContext(key))
})
12 changes: 6 additions & 6 deletions tests/test-core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ describe('core', () => {
const repoExample = process.cwd() + '/tests/repo-example'
const repoTests = process.cwd() + '/tests/repo-tests-run'

before(done => {
ncp(repoExample, repoTests, err => {
before((done) => {
ncp(repoExample, repoTests, (err) => {
process.env.IPFS_PATH = repoTests
expect(err).to.equal(null)
done()
})
})

after(done => {
rimraf(repoTests, err => {
after((done) => {
rimraf(repoTests, (err) => {
expect(err).to.equal(null)
done()
})
})

const tests = fs.readdirSync(__dirname)
tests.filter(file => {
tests.filter((file) => {
if (file === 'index.js' || file === 'browser.js') {
return false
} else {
return true
}
}).forEach(file => {
}).forEach((file) => {
require('./' + file)
})
})
4 changes: 2 additions & 2 deletions tests/test-core/test-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('block', function () {
done()
})
})
it('put', done => {
it('put', (done) => {
var b = new Block('random data')
ipfs.block.put(b, function (err) {
expect(err).to.not.exist
Expand All @@ -40,7 +40,7 @@ describe('block', function () {
})
})

it('rm', done => {
it('rm', (done) => {
var b = new Block('I will not last long enough')
ipfs.block.put(b, function (err) {
expect(err).to.not.exist
Expand Down
10 changes: 5 additions & 5 deletions tests/test-core/test-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ describe('bootstrap', () => {
'/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT'
]

it('get bootstrap list', done => {
it('get bootstrap list', (done) => {
ipfs.bootstrap.list((err, list) => {
expect(err).to.not.exist
expect(list).to.deep.equal(defaultList)
done()
})
})

it('add a peer to the bootstrap list', done => {
ipfs.bootstrap.add('/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT', err => {
it('add a peer to the bootstrap list', (done) => {
ipfs.bootstrap.add('/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT', (err) => {
expect(err).to.not.exist
ipfs.bootstrap.list((err, list) => {
expect(err).to.not.exist
Expand All @@ -52,8 +52,8 @@ describe('bootstrap', () => {
})
})

it('remove a peer from the bootstrap list', done => {
ipfs.bootstrap.rm('/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT', err => {
it('remove a peer from the bootstrap list', (done) => {
ipfs.bootstrap.rm('/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT', (err) => {
expect(err).to.not.exist
ipfs.bootstrap.list((err, list) => {
expect(err).to.not.exist
Expand Down
Loading

0 comments on commit 45fb69c

Please sign in to comment.