remove glob dep, fixes #20

This commit is contained in:
Dave Eddy 2015-09-21 14:01:00 -04:00
parent d0bb926584
commit 6159bf404d
2 changed files with 11 additions and 8 deletions

View File

@ -36,7 +36,6 @@ var assert = require('assert-plus');
var format = require('util').format;
var fs = require('fs');
var mkdirp = require('mkdirp');
var glob = require('glob');
var path = require('path');
var vasync = require('vasync');
@ -274,15 +273,20 @@ function loadAllProfiles(opts) {
assert.object(opts.log, 'opts.log');
var profiles = [];
var files = glob.sync(path.resolve(opts.configDir,
'profiles.d', '*.json'));
for (var i = 0; i < files.length; i++) {
var file = files[i];
var d = path.join(opts.configDir, 'profiles.d');
var files = fs.readdirSync(d);
files.forEach(function (file) {
file = path.join(d, file);
var ext = path.extname(file);
if (ext !== '.json')
return;
var name = path.basename(file).slice(0, - path.extname(file).length);
if (name.toLowerCase() === 'env') {
// Skip the special 'env'.
opts.log.debug('skip reserved name "env" profile: %s', file);
continue;
return;
}
try {
profiles.push(_profileFromPath(file, name));
@ -290,7 +294,7 @@ function loadAllProfiles(opts) {
opts.log.warn({err: e, profilePath: file},
'error loading profile; skipping');
}
}
});
return profiles;
}

View File

@ -12,7 +12,6 @@
"cmdln": "3.3.0",
"dashdash": "1.10.0",
"extsprintf": "1.0.2",
"glob": "5.0.14",
"lomstream": "1.1.0",
"mkdirp": "0.5.1",
"node-uuid": "1.4.3",