Merge branch 'master' of github.com:ryanmcgrath/wrench-js
This commit is contained in:
commit
d1ffccba60
4 changed files with 13 additions and 18 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ exports.readdirSyncRecursive = function(baseDir) {
|
||||||
|
|
||||||
// convert absolute paths to relative
|
// convert absolute paths to relative
|
||||||
var fileList = readdirSyncRecursive(baseDir).map(function(val){
|
var fileList = readdirSyncRecursive(baseDir).map(function(val){
|
||||||
return val.replace(baseDir + '/', '');
|
return _path.relative(baseDir, val);
|
||||||
});
|
});
|
||||||
|
|
||||||
return fileList;
|
return fileList;
|
||||||
|
|
@ -106,7 +106,7 @@ exports.readdirRecursive = function(baseDir, fn) {
|
||||||
|
|
||||||
fn(null, curFiles.map(function(val) {
|
fn(null, curFiles.map(function(val) {
|
||||||
// convert absolute paths to relative
|
// convert absolute paths to relative
|
||||||
return val.replace(baseDir + '/', '');
|
return _path.relative(baseDir, val);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (waitCount == 0) {
|
if (waitCount == 0) {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodeunit": ">= 0.6.4",
|
"nodeunit": ">= 0.6.4"
|
||||||
"underscore": ">= 1.3.1"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"main": "./lib/wrench",
|
"main": "./lib/wrench",
|
||||||
|
|
@ -31,7 +30,7 @@
|
||||||
"node": ">=0.1.97"
|
"node": ">=0.1.97"
|
||||||
},
|
},
|
||||||
|
|
||||||
"scripts": { "test": "./node_modules/nodeunit/bin/nodeunit tests/runner.js" },
|
"scripts": { "test": "nodeunit tests/runner.js" },
|
||||||
|
|
||||||
"licenses": [{
|
"licenses": [{
|
||||||
"type" : "MIT",
|
"type" : "MIT",
|
||||||
|
|
|
||||||
|
|
@ -2,31 +2,26 @@ var testCase = require('nodeunit').testCase;
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var wrench = require('../lib/wrench');
|
var wrench = require('../lib/wrench');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var _und = require("underscore");
|
|
||||||
|
|
||||||
|
|
||||||
function checkResult(test, files) {
|
function checkResult(test, files) {
|
||||||
var check = [
|
var check = [
|
||||||
'bar.txt',
|
'bar.txt',
|
||||||
'foo',
|
'foo',
|
||||||
'foo/bar',
|
path.join('foo', 'bar'),
|
||||||
'foo/dolor.md',
|
path.join('foo', 'dolor.md'),
|
||||||
'foo/lorem.txt',
|
path.join('foo', 'lorem.txt'),
|
||||||
'foo/bar/ipsum.js'
|
path.join('foo', 'bar', 'ipsum.js')
|
||||||
];
|
];
|
||||||
|
|
||||||
test.equals(files.length, check.length, 'number of paths is correct');
|
test.deepEqual(files, check);
|
||||||
|
|
||||||
_und.each(check, function(it) {
|
|
||||||
test.ok(_und.include(files, it), 'path ' + it + ' should be returned');
|
|
||||||
});
|
|
||||||
|
|
||||||
test.done();
|
test.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = testCase({
|
module.exports = testCase({
|
||||||
test_readdirSyncRecursive: function(test) {
|
test_readdirSyncRecursive: function(test) {
|
||||||
var dir = __dirname + '/readdir';
|
var dir = path.join(__dirname, 'readdir');
|
||||||
|
|
||||||
test.ok(path.existsSync(dir), 'Folders should exist');
|
test.ok(path.existsSync(dir), 'Folders should exist');
|
||||||
|
|
||||||
|
|
@ -36,7 +31,7 @@ module.exports = testCase({
|
||||||
},
|
},
|
||||||
|
|
||||||
test_readdirRecursive: function(test) {
|
test_readdirRecursive: function(test) {
|
||||||
var dir = __dirname + '/readdir';
|
var dir = path.join(__dirname, 'readdir');
|
||||||
|
|
||||||
test.ok(path.existsSync(dir), 'Folders should exist');
|
test.ok(path.existsSync(dir), 'Folders should exist');
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue