Skip to content

Commit

Permalink
multiarch support
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed Apr 13, 2015
1 parent 2346bcf commit b865b08
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 4 deletions.
1 change: 1 addition & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
21 changes: 21 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"node": true,
"curly": true,
"eqeqeq": true,
"freeze": true,
"immed": true,
"indent": 2,
"latedef": false,
"newcap": true,
"noarg": true,
"noempty": true,
"nonbsp": true,
"nonew": true,
"plusplus": false,
"quotmark": "single",
"undef": true,
"unused": true,
"maxparams": 4,
"maxdepth": 4,
"maxlen": 120
}
6 changes: 6 additions & 0 deletions .validate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"scripts": {
"lint": "jshint ."
},
"pre-commit": ["lint", "validate", "test"]
}
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

var util = require('util'),
path = require('path'),
os = require('os'),
split = require('split'),
through = require('through2'),
child = require('child_process'),
exec = path.resolve(__dirname, 'build/pbf2json');
exec = path.join(__dirname, 'build', util.format( 'pbf2json.%s-%s', os.platform(), os.arch() ) );

function errorHandler( name ){
return function( data ){
Expand Down Expand Up @@ -46,7 +47,7 @@ function createReadStream( config ){
decoder.kill = function(){
proc.kill();
decoder.end();
}
};

return decoder;
}
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"homepage": "https://github.com/pelias/pbf2json",
"license": "MIT",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 0"
"test": "node test/run.js | tap-spec"
},
"bin": {
"pbf2json": "./build/pbf2json"
Expand All @@ -31,5 +31,10 @@
"dependencies": {
"split": "^0.3.2",
"through2": "^0.6.3"
},
"devDependencies": {
"tape": "^2.13.4",
"tap-spec": "^0.2.0",
"precommit-hook": "1.0.7"
}
}
}
22 changes: 22 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

var index = require('../index');

module.exports.tests = {};

module.exports.tests.interface = function(test) {
test('valid interface', function(t) {
t.equal(typeof index.createReadStream, 'function', 'valid function');
t.end();
});
};

module.exports.all = function (tape, common) {

function test(name, testFunction) {
return tape('index: ' + name, testFunction);
}

for( var testCase in module.exports.tests ){
module.exports.tests[testCase](test, common);
}
};
11 changes: 11 additions & 0 deletions test/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

var tape = require('tape');
var common = {};

var tests = [
require('./index.js')
];

tests.map(function(t) {
t.all(tape, common);
});

0 comments on commit b865b08

Please sign in to comment.