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

Commit

Permalink
Merge branch 'master' into feature/pin
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamStone committed May 20, 2016
2 parents 11765de + d0d2d34 commit 7db4a69
Show file tree
Hide file tree
Showing 86 changed files with 2,354 additions and 1,418 deletions.
14 changes: 12 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ language: node_js
node_js:
- 4
- 5
- stable

# Make sure we have new NPM.
before_install:
Expand All @@ -13,12 +14,21 @@ script:
- npm test
- npm run coverage

addons:
firefox: 'latest'

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

after_success:
- npm run coverage-publish

env:
- CXX=g++-4.8

addons:
firefox: 'latest'
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Consult the [Roadmap](/ROADMAP.md) for a complete state description of the proje
IPFS implementation in JavaScript is a work in progress. As such, there's a few things you can do right now to help out:

* Go through the modules below and **check out existing issues**. This would be especially useful for modules in active development. Some knowledge of IPFS may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
* **Perform code reviews**. Most of this has been developed by @diasdavid, which means that more eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
* **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
* Take a look at go-ipfs and some of the planning repositories or issues: for instance, the libp2p spec [here](https://github.com/ipfs/specs/pull/19). Contributions here that would be most helpful are **top-level comments** about how it should look based on our understanding. Again, the more eyes the better.
* **Add tests**. There can never be enough tests.
* **Contribute to the [FAQ repository](https://github.com/ipfs/faq/issues)** with any questions you have about IPFS or any of the relevant technology. A good example would be asking, 'What is a merkledag tree?'. If you don't know a term, odds are, someone else doesn't either. Eventually, we should have a good understanding of where we need to improve communications and teaching together to make IPFS and IPN better.
Expand All @@ -47,13 +47,13 @@ var node = new IPFS()

## Through command line tool

In order to use js-ipfs as a CLI, you must install it with the -g flag.
In order to use js-ipfs as a CLI, you must install it with the `global` flag.

```bash
$ npm install ipfs --global
```

The cli is availble through `jsipfs` in your terminal
The cli is available through `jsipfs` in your terminal

## Use in the browser with browserify, webpack or any bundler

Expand Down Expand Up @@ -173,3 +173,11 @@ Files is the API that lets us work with IPFS objects (DAG Nodes) as if they were
#### Importer

Importer are a set of layouts (e.g. UnixFS) and chunkers (e.g: fixed-size, rabin, etc) that convert data to a MerkleDAG representation inside IPFS.

## License

MIT.

# Want to hack on IPFS?

[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)
41 changes: 41 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict'

const gulp = require('gulp')
const parallel = require('run-parallel')
const series = require('run-series')
const createTempNode = require('./test/utils/temp-node')
const API = require('./src/http-api')

let nodes = []

function startNode (num, done) {
createTempNode(num, (err, node) => {
if (err) throw err

const api = new API(node.repo.path())
nodes.push(api)
api.start(done)
})
}

gulp.task('libnode:start', (done) => {
nodes = []
parallel([
(cb) => startNode(7, cb),
(cb) => startNode(8, cb),
(cb) => startNode(9, cb)
], done)
})

gulp.task('libnode:stop', (done) => {
series(nodes.map((node) => (cb) => {
setTimeout(() => node.stop(cb), 500)
}), done)
})

gulp.task('test:browser:before', ['libnode:start'])
gulp.task('test:node:before', ['libnode:start'])
gulp.task('test:browser:after', ['libnode:stop'])
gulp.task('test:node:after', ['libnode:stop'])

require('aegir/gulp')(gulp)
73 changes: 42 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ipfs",
"version": "0.4.6",
"version": "0.5.0",
"description": "JavaScript implementation of the IPFS specification",
"bin": {
"jsipfs": "src/cli/bin.js"
Expand All @@ -9,14 +9,14 @@
"jsnext:main": "src/core/index.js",
"scripts": {
"lint": "aegir-lint",
"coverage": "aegir-coverage",
"test": "aegir-test",
"test:node": "aegir-test node",
"test:browser": "aegir-test browser",
"build": "aegir-build",
"release": "aegir-release",
"release:minor": "aegir-release minor",
"release:major": "aegir-release major",
"coverage": "gulp coverage",
"test": "gulp test",
"test:node": "gulp test:node",
"test:browser": "gulp test:browser",
"build": "gulp build",
"release": "gulp release",
"release-minor": "gulp release --type minor",
"release-major": "gulp release --type major",
"coverage-publish": "aegir-coverage publish"
},
"pre-commit": [
Expand All @@ -37,62 +37,73 @@
},
"homepage": "https://github.com/ipfs/js-ipfs#readme",
"devDependencies": {
"aegir": "^2.1.1",
"async": "^1.5.2",
"aegir": "^3.0.2",
"buffer-loader": "0.0.1",
"chai": "^3.5.0",
"expose-loader": "^0.7.1",
"form-data": "^1.0.0-rc3",
"idb-plus-blob-store": "^1.0.0",
"local-storage-blob-store": "0.0.3",
"lodash": "^4.11.1",
"mocha": "^2.3.4",
"gulp": "^3.9.1",
"idb-plus-blob-store": "^1.1.2",
"interface-ipfs-core": "^0.1.5",
"libp2p-ipfs-browser": "^0.2.0",
"lodash": "^4.11.2",
"mocha": "^2.4.5",
"ncp": "^2.0.0",
"nexpect": "^0.5.0",
"pre-commit": "^1.1.2",
"rimraf": "^2.4.4",
"snazzy": "^3.0.1",
"rimraf": "^2.5.2",
"stream-to-promise": "^1.1.0",
"transform-loader": "^0.2.3"
},
"dependencies": {
"babel-runtime": "^6.6.1",
"bl": "^1.1.2",
"boom": "^3.1.1",
"boom": "^3.1.2",
"bs58": "^3.0.0",
"debug": "^2.2.0",
"fnv": "^0.1.3",
"fs-blob-store": "^5.2.1",
"glob": "^7.0.3",
"hapi": "^13.3.0",
"ipfs-api": "^3.0.1",
"ipfs-blocks": "^0.2.0",
"ipfs-data-importing": "^0.3.3",
"ipfs-merkle-dag": "^0.4.0",
"ipfs-api": "^4.0.2",
"ipfs-bitswap": "^0.2.0",
"ipfs-block": "^0.3.0",
"ipfs-block-service": "^0.4.0",
"ipfs-merkle-dag": "^0.6.0",
"ipfs-multipart": "^0.1.0",
"ipfs-repo": "^0.6.1",
"joi": "^8.0.2",
"libp2p-ipfs": "^0.3.1",
"lodash.get": "^4.2.1",
"lodash.set": "^4.0.0",
"multiaddr": "^1.3.0",
"ipfs-repo": "^0.8.0",
"ipfs-unixfs-engine": "^0.6.1",
"joi": "^8.0.5",
"libp2p-ipfs": "^0.3.8",
"libp2p-swarm": "^0.12.11",
"lodash.get": "^4.3.0",
"lodash.set": "^4.2.0",
"multiaddr": "^1.4.1",
"path-exists": "^3.0.0",
"peer-book": "^0.1.1",
"peer-id": "^0.6.6",
"peer-info": "^0.6.2",
"promisify-es6": "^1.0.1",
"protocol-buffers": "^3.1.6",
"readable-stream": "1.1.13",
"ronin": "^0.3.11",
"run-parallel": "^1.1.6",
"run-parallel-limit": "^1.0.3",
"run-series": "^1.1.4",
"run-waterfall": "^1.1.3",
"temp": "^0.8.3",
"varint": "^4.0.0"
},
"aegir": {
"webpack": {
"resolve": {
"alias": {
"node-forge": "../../../node_modules/peer-id/vendor/forge.bundle.js"
"node-forge": "../../../node_modules/peer-id/vendor/forge.bundle.js",
"libp2p-ipfs": "libp2p-ipfs-browser"
}
},
"externals": {
"fs": "{}",
"ipfs-data-importing": "{ import: {} }",
"libp2p-ipfs": "{}",
"mkdirp": "{}"
}
}
Expand Down
38 changes: 38 additions & 0 deletions src/cli/commands/bitswap/stat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
'use strict'

const Command = require('ronin').Command
const utils = require('../../utils')

module.exports = Command.extend({
desc: 'Show some diagnostic information on the bitswap agent.',

options: {
},

run: () => {
utils.getIPFS((err, ipfs) => {
if (err) {
throw err
}

ipfs.bitswap.stat((err, stats) => {
if (err) {
throw err
}

stats.Wantlist = stats.Wantlist || []
stats.Peers = stats.Peers || []

console.log(`
bitswap status
blocks received: ${stats.BlocksReceived}
dup blocks received: ${stats.DupBlksReceived}
dup data received: ${stats.DupDataReceived}B
wantlist [${stats.Wantlist.length} keys]
${stats.Wantlist.join('\n ')}
partners [${stats.Peers.length}]
${stats.Peers.join('\n ')}`)
})
})
}
})
24 changes: 24 additions & 0 deletions src/cli/commands/bitswap/unwant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict'

const Command = require('ronin').Command
const utils = require('../../utils')

module.exports = Command.extend({
desc: 'Remove a given block from your wantlist.',

options: {
key: {
required: true
}
},

run: (key) => {
utils.getIPFS((err, ipfs) => {
if (err) {
throw err
}

throw new Error('Not implemented yet')
})
}
})
27 changes: 27 additions & 0 deletions src/cli/commands/bitswap/wantlist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict'

const Command = require('ronin').Command
const utils = require('../../utils')

module.exports = Command.extend({
desc: 'Print out all blocks currently on the bitswap wantlist for the local peer.',

options: {
},

run: () => {
utils.getIPFS((err, ipfs) => {
if (err) {
throw err
}

ipfs.bitswap.wantlist((err, res) => {
if (err) {
throw err
}

res.Keys.forEach((k) => console.log(k))
})
})
}
})
1 change: 0 additions & 1 deletion src/cli/commands/block/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module.exports = Command.extend({

ipfs.block.get(mh, (err, block) => {
if (err) {
log.error(err)
throw err
}

Expand Down
5 changes: 1 addition & 4 deletions src/cli/commands/block/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const utils = require('../../utils')
const bs58 = require('bs58')
const bl = require('bl')
const fs = require('fs')
const Block = require('ipfs-blocks').Block
const Block = require('ipfs-block')
const debug = require('debug')
const log = debug('cli:block')
log.error = debug('cli:block:error')
Expand All @@ -19,7 +19,6 @@ function addBlock (buf) {
if (utils.isDaemonOn()) {
return ipfs.block.put(buf, (err, block) => {
if (err) {
log.error(err)
throw err
}

Expand All @@ -31,7 +30,6 @@ function addBlock (buf) {

ipfs.block.put(block, (err, obj) => {
if (err) {
log.error(err)
throw err
}

Expand All @@ -52,7 +50,6 @@ module.exports = Command.extend({

process.stdin.pipe(bl((err, input) => {
if (err) {
log.error(err)
throw err
}

Expand Down
1 change: 0 additions & 1 deletion src/cli/commands/block/rm.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module.exports = Command.extend({

ipfs.block.del(mh, (err) => {
if (err) {
log.error(err)
throw err
}

Expand Down
1 change: 0 additions & 1 deletion src/cli/commands/block/stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module.exports = Command.extend({

ipfs.block.stat(mh, (err, block) => {
if (err) {
log.error(err)
throw err
}

Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/bootstrap/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = Command.extend({
}
ipfs.bootstrap.add(multiaddr, (err, list) => {
if (err) {
return log.error(err)
throw err
}
})
})
Expand Down
Loading

0 comments on commit 7db4a69

Please sign in to comment.