Skip to content

Commit 60b126b

Browse files
Merge pull request #79 from ipfs/upgrade
Upgrade
2 parents 857d31d + 0231951 commit 60b126b

File tree

11 files changed

+140
-54
lines changed

11 files changed

+140
-54
lines changed

.gitignore

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
1-
node_modules
1+
**/node_modules/
2+
**/*.log
3+
test/repo-tests*
4+
5+
# Logs
6+
logs
27
*.log
8+
9+
coverage
10+
11+
# Runtime data
12+
pids
13+
*.pid
14+
*.seed
15+
16+
# Directory for instrumented libs generated by jscoverage/JSCover
17+
lib-cov
18+
19+
# Coverage directory used by tools like istanbul
20+
coverage
21+
22+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
23+
.grunt
24+
25+
# node-waf configuration
26+
.lock-wscript
27+
28+
build
29+
30+
# Dependency directory
31+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
32+
node_modules
33+
34+
lib
35+
dist

.npmignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
**/node_modules/
2+
**/*.log
3+
test/repo-tests*
4+
5+
# Logs
6+
logs
7+
*.log
8+
9+
coverage
10+
11+
# Runtime data
12+
pids
13+
*.pid
14+
*.seed
15+
16+
# Directory for instrumented libs generated by jscoverage/JSCover
17+
lib-cov
18+
19+
# Coverage directory used by tools like istanbul
20+
coverage
21+
22+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
23+
.grunt
24+
25+
# node-waf configuration
26+
.lock-wscript
27+
28+
build
29+
30+
# Dependency directory
31+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
32+
node_modules

.travis.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1+
sudo: false
12
language: node_js
23
node_js:
3-
- "4"
4-
- "5"
4+
- 4
5+
- 5
6+
- stable
7+
8+
# Make sure we have new NPM.
9+
before_install:
10+
- npm install -g npm
11+
12+
script:
13+
- npm run lint
14+
- npm test
15+
- npm run coverage
16+
17+
before_script:
18+
- export DISPLAY=:99.0
19+
- sh -e /etc/init.d/xvfb start
20+
21+
after_success:
22+
- npm run coverage-publish
23+
24+
addons:
25+
firefox: 'latest'

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
ipfsd-ctl
22
=========
33

4-
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
5-
[![Dependency Status](https://david-dm.org/ipfs/js-ipfsd-ctl.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfsd-ctl)
4+
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
5+
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
6+
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
7+
[![Coverage Status](https://coveralls.io/repos/github/ipfs/js-ipfsd-ctl/badge.svg?branch=master)](https://coveralls.io/github/ipfs/js-ipfsd-ctl?branch=master)
68
[![Travis CI](https://travis-ci.org/ipfs/js-ipfsd-ctl.svg?branch=master)](https://travis-ci.org/ipfs/js-ipfsd-ctl)
79
[![Circle CI](https://circleci.com/gh/ipfs/js-ipfsd-ctl.svg?style=svg)](https://circleci.com/gh/ipfs/js-ipfsd-ctl)
8-
10+
[![Dependency Status](https://david-dm.org/ipfs/js-ipfsd-ctl.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfsd-ctl) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
911

1012
> Control an ipfs node daemon using Node.js
1113

examples/id.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
var ipfsd = require('../index.js')
24

35
ipfsd.disposableApi(function (err, ipfs) {

examples/local.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
var ipfsd = require('../index.js')
24

35
// opens an api connection to local running ipfs node

package.json

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22
"name": "ipfsd-ctl",
33
"version": "0.13.0",
44
"description": "simple controls for an ipfs node",
5-
"main": "index.js",
5+
"main": "lib/index.js",
6+
"jsxnext:main": "src/index.js",
67
"scripts": {
7-
"test": "node_modules/.bin/mocha test",
8-
"lint": "standard"
8+
"lint": "aegir-lint",
9+
"coverage": "aegir-coverage",
10+
"test": "aegir-test --env node",
11+
"build": "aegir-build --env node",
12+
"release": "aegir-release --env node",
13+
"release:minor": "aegir-release --type minor --env node",
14+
"release:major": "aegir-release --type major --env node",
15+
"coverage-publish": "aegir-coverage publish"
916
},
1017
"engines": {
1118
"node": ">=4.2.2"
@@ -26,20 +33,18 @@
2633
],
2734
"license": "MIT",
2835
"dependencies": {
29-
"ipfs-api": "^3.0.0",
3036
"go-ipfs-dep": "0.4.1",
31-
"multiaddr": "^1.1.1",
37+
"ipfs-api": "^4.1.0",
38+
"multiaddr": "^2.0.0",
3239
"rimraf": "^2.4.5",
40+
"run-series": "^1.1.4",
3341
"shutdown": "^0.2.4",
34-
"subcomandante": "^1.0.5",
35-
"async": "^1.5.0"
42+
"subcomandante": "^1.0.5"
3643
},
3744
"devDependencies": {
38-
"estraverse": "^4.1.1",
45+
"aegir": "^3.0.4",
3946
"mkdirp": "^0.5.1",
40-
"mocha": "^2.3.4",
41-
"pre-commit": "^1.1.2",
42-
"standard": "^6.0.8"
47+
"pre-commit": "^1.1.2"
4348
},
4449
"repository": {
4550
"type": "git",

index.js renamed to src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
const os = require('os')
44
const join = require('path').join
55

6-
const Node = require('./lib/node')
6+
const Node = require('./node')
77

88
function tempDir () {
9-
return join(os.tmpdir(), `ipfs_${(Math.random() + '').substr(2)}`)
9+
return join(os.tmpdir(), `ipfs_${String(Math.random()).substr(2)}`)
1010
}
1111

1212
module.exports = {

lib/node.js renamed to src/node.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const fs = require('fs')
44
const run = require('subcomandante')
5-
const async = require('async')
5+
const series = require('run-series')
66
const ipfs = require('ipfs-api')
77
const multiaddr = require('multiaddr')
88
const rimraf = require('rimraf')
@@ -30,17 +30,15 @@ function findIpfsExecutable () {
3030
}
3131

3232
function configureNode (node, conf, done) {
33-
if (Object.keys(conf).length > 0) {
34-
async.forEachOfSeries(conf, (value, key, cb) => {
35-
const env = {env: node.env}
36-
37-
run(node.exec, ['config', key, '--json', JSON.stringify(value)], env)
38-
.on('error', cb)
39-
.on('end', cb)
40-
}, done)
41-
} else {
42-
done()
43-
}
33+
const keys = Object.keys(conf)
34+
series(keys.map((key) => (cb) => {
35+
const value = conf[key]
36+
const env = {env: node.env}
37+
38+
run(node.exec, ['config', key, '--json', JSON.stringify(value)], env)
39+
.on('error', cb)
40+
.on('end', cb)
41+
}), done)
4442
}
4543

4644
// Consistent error handling
@@ -126,17 +124,17 @@ module.exports = class Node {
126124

127125
this.subprocess = run(this.exec, ['daemon'], {env: this.env})
128126
.on('error', (err) => {
129-
if ((err + '').match('daemon is running')) {
127+
if (String(err).match('daemon is running')) {
130128
// we're good
131129
done(null, ipfs(conf.Addresses.API))
132-
} else if ((err + '').match('non-zero exit code')) {
130+
} else if (String(err).match('non-zero exit code')) {
133131
// ignore when kill -9'd
134132
} else {
135133
done(err)
136134
}
137135
})
138136
.on('data', (data) => {
139-
const match = (data + '').trim().match(/API server listening on (.*)/)
137+
const match = String(data).trim().match(/API server listening on (.*)/)
140138
if (match) {
141139
this.apiAddr = match[1]
142140
const addr = multiaddr(this.apiAddr).nodeAddress()

test/.eslintrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)