Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
refactor: use aegir
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Apr 15, 2016
1 parent fe9fadb commit 6d2e669
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 98 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

lib
dist
29 changes: 29 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

test
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
sudo: false
language: node_js
node_js:
- 4
- 5

# Make sure we have new NPM.
before_install:
- npm install -g npm

script:
- npm run lint
- 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
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
js-libp2p-railing
=================

[![](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) ![](https://img.shields.io/badge/coverage-%3F-yellow.svg?style=flat-square) [![Dependency Status](https://david-dm.org/diasdavid/js-libp2p-railing.svg?style=flat-square)](https://david-dm.org/diasdavid/js-libp2p-railing) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
[![](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)
[![Coverage Status](https://coveralls.io/repos/github/diasdavid/js-libp2p-railing/badge.svg?branch=master)](https://coveralls.io/github/diasdavid/js-libp2p-railing?branch=master)
[![Travis CI](https://travis-ci.org/diasdavid/js-libp2p-railing.svg?branch=master)](https://travis-ci.org/diasdavid/js-libp2p-railing)
[![Circle CI](https://circleci.com/gh/diasdavid/js-libp2p-railing.svg?style=svg)](https://circleci.com/gh/diasdavid/js-libp2p-railing)
[![Dependency Status](https://david-dm.org/diasdavid/js-libp2p-railing.svg?style=flat-square)](https://david-dm.org/diasdavid/js-libp2p-railing) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)

> JavaScript libp2p Implementation of the railing process of a Node through a bootstrap peer list
Expand All @@ -11,7 +15,7 @@ js-libp2p-railing
var Bootstrap = require('ipfs-libp2p')

var options = {
verify: true // to verify that we can indeed open a connection to that peer, before declaring it as peer found
verify: true // to verify that we can indeed open a connection to that peer, before declaring it as peer found
}

var peerList = <your custom peerList> || Bootstrap.default
Expand Down
12 changes: 12 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
machine:
node:
version: stable

dependencies:
pre:
- google-chrome --version
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
- sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
- sudo apt-get update
- sudo apt-get --only-upgrade install google-chrome-stable
- google-chrome --version
4 changes: 4 additions & 0 deletions examples/try.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
'use strict'

var Bootstrap = require('./../src')
var b = new Bootstrap(Bootstrap.default)

console.log(b)
25 changes: 18 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
"name": "libp2p-railing",
"version": "0.2.1",
"description": "Node.js IPFS Implementation of the railing process of a Node through a bootstrap peer list",
"main": "src/index.js",
"main": "lib/index.js",
"scripts": {
"test": "./node_modules/.bin/lab tests/*-test.js"
"test": "aegir-test",
"lint": "aegir-lint",
"test:node": "aegir-test node",
"test:browser": "aegir-test browser",
"build": "aegir-build",
"release": "aegir-release",
"coverage": "aegir-coverage",
"coverage-publish": "aegir-coverage publish"
},
"repository": {
"type": "git",
Expand All @@ -23,17 +30,21 @@
},
"homepage": "https://github.com/diasdavid/js-ipfs-railing",
"devDependencies": {
"code": "^1.4.1",
"lab": "^5.13.0",
"aegir": "^2.1.1",
"chai": "^3.5.0",
"libp2p-swarm": "^0.5.0",
"libp2p-tcp": "^0.1.1",
"pre-commit": "^1.1.1",
"standard": "^4.5.4"
"pre-commit": "^1.1.2"
},
"dependencies": {
"ipfs-logger": "^0.1.0",
"peer-info": "^0.3.0",
"peer-id": "^0.3.0",
"multiaddr": "^1.0.0"
}
},
"jsnext:main": "src/index.js",
"pre-commit": [
"lint",
"test"
]
}
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

var Id = require('peer-id')
var Peer = require('peer-info')
var multiaddr = require('multiaddr')
Expand Down
22 changes: 22 additions & 0 deletions test/verify-off.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-env mocha */
'use strict'

var Bootstrap = require('./../src')

describe('Without verify on', function () {
before(function (done) {
done()
})

it('Find the other peer', function (done) {
this.timeout(1e3 * 10)

var bA = new Bootstrap(Bootstrap.default, {
verify: false
})

bA.once('peer', function (peer) {
done()
})
})
})
59 changes: 59 additions & 0 deletions test/verify-on.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* eslint-env mocha */
'use strict'

var multiaddr = require('multiaddr')
var Id = require('peer-id')
var Peer = require('peer-info')
var Swarm = require('libp2p-swarm')
var tcp = require('libp2p-tcp')

var Broadcast = require('./../src')

var pA
var pB
var swA
var swB

describe('With verify on', function () {
before(function (done) {
var mh1 = multiaddr('/ip4/127.0.0.1/tcp/8010')
pA = new Peer(Id.create(), [])
swA = new Swarm(pA)
swA.addTransport('tcp', tcp, { multiaddr: mh1 }, {}, {port: 8010}, ready)

var mh2 = multiaddr('/ip4/127.0.0.1/tcp/8020')
pB = new Peer(Id.create(), [])
swB = new Swarm(pB)
swB.addTransport('tcp', tcp, { multiaddr: mh2 }, {}, {port: 8020}, ready)

var readyCounter = 0

function ready () {
readyCounter++
if (readyCounter < 2) {
return
}
done()
}
})

after(function (done) {
swA.close()
swB.close()
done()
})

it('Find the other peer', function (done) {
this.timeout(1e3 * 10)
var peerList = [
pB.multiaddrs[0].toString() + '/ipfs/' + pB.id.toB58String()
]
var bA = new Broadcast(peerList, {
verify: true
}, swA)

bA.once('peer', function (peer) {
done()
})
})
})
24 changes: 0 additions & 24 deletions tests/verify-off-test.js

This file was deleted.

65 changes: 0 additions & 65 deletions tests/verify-on-test.js

This file was deleted.

0 comments on commit 6d2e669

Please sign in to comment.