Skip to content

Commit

Permalink
0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
danielstjules committed Sep 21, 2014
1 parent 45028df commit d92189b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 33 deletions.
40 changes: 9 additions & 31 deletions bin/buddy
@@ -1,9 +1,7 @@
#!/usr/bin/env node

var sep = require('path').sep;
var chalk = require('chalk');
var fs = require('fs');
var file = require('file');
var filepaths = require('node-filepaths');
var program = require('commander');
var Detector = require('../lib/detector');
var reporters = require('../lib/reporters');
Expand Down Expand Up @@ -32,35 +30,15 @@ if (!program.color) {
}

// Iterate over the given paths, and recurse if they're directories
var paths = [];
suppliedPaths.forEach(function(path) {
try {
if (fs.statSync(path).isFile()) {
return paths.push(path);
}
} catch(e) {
console.log('No such file or directory:', path);
process.exit(3);
}

// Look for .js files, ignore node_modules, cleanup paths
file.walkSync(path, function(dirPath, dirs, files) {
files.forEach(function(file) {
if (file.slice(-3) !== '.js') return;
if (dirPath.indexOf('node_modules') > -1) return;

if (dirPath.slice(-1) !== sep) {
dirPath += sep;
}

if (dirPath.indexOf(sep) !== 0 && dirPath.indexOf('.') !== 0) {
dirPath = './' + dirPath;
}

paths.push(dirPath + file);
});
try {
var paths = filepaths.getSync(suppliedPaths, {
suffix: '.js',
ignore: 'node_modules'
});
});
} catch(e) {
console.log(e.message);
process.exit(3);
}

if (!paths.length) {
console.log('No .js files found in the list of paths');
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "buddy.js",
"version": "0.6.0",
"version": "0.6.1",
"description": "Magic number detector for javascript",
"keywords": [
"magic",
Expand All @@ -25,7 +25,7 @@
"bluebird": "*",
"acorn": "0.7.0",
"commander": "*",
"file": "*",
"node-filepaths": "*",
"chalk": "*"
},
"devDependencies": {
Expand Down

0 comments on commit d92189b

Please sign in to comment.