remove glob dep, fixes #20
This commit is contained in:
parent
d0bb926584
commit
6159bf404d
@ -36,7 +36,6 @@ var assert = require('assert-plus');
|
|||||||
var format = require('util').format;
|
var format = require('util').format;
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var mkdirp = require('mkdirp');
|
var mkdirp = require('mkdirp');
|
||||||
var glob = require('glob');
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var vasync = require('vasync');
|
var vasync = require('vasync');
|
||||||
|
|
||||||
@ -274,15 +273,20 @@ function loadAllProfiles(opts) {
|
|||||||
assert.object(opts.log, 'opts.log');
|
assert.object(opts.log, 'opts.log');
|
||||||
|
|
||||||
var profiles = [];
|
var profiles = [];
|
||||||
var files = glob.sync(path.resolve(opts.configDir,
|
|
||||||
'profiles.d', '*.json'));
|
var d = path.join(opts.configDir, 'profiles.d');
|
||||||
for (var i = 0; i < files.length; i++) {
|
var files = fs.readdirSync(d);
|
||||||
var file = files[i];
|
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);
|
var name = path.basename(file).slice(0, - path.extname(file).length);
|
||||||
if (name.toLowerCase() === 'env') {
|
if (name.toLowerCase() === 'env') {
|
||||||
// Skip the special 'env'.
|
// Skip the special 'env'.
|
||||||
opts.log.debug('skip reserved name "env" profile: %s', file);
|
opts.log.debug('skip reserved name "env" profile: %s', file);
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
profiles.push(_profileFromPath(file, name));
|
profiles.push(_profileFromPath(file, name));
|
||||||
@ -290,7 +294,7 @@ function loadAllProfiles(opts) {
|
|||||||
opts.log.warn({err: e, profilePath: file},
|
opts.log.warn({err: e, profilePath: file},
|
||||||
'error loading profile; skipping');
|
'error loading profile; skipping');
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
return profiles;
|
return profiles;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
"cmdln": "3.3.0",
|
"cmdln": "3.3.0",
|
||||||
"dashdash": "1.10.0",
|
"dashdash": "1.10.0",
|
||||||
"extsprintf": "1.0.2",
|
"extsprintf": "1.0.2",
|
||||||
"glob": "5.0.14",
|
|
||||||
"lomstream": "1.1.0",
|
"lomstream": "1.1.0",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"node-uuid": "1.4.3",
|
"node-uuid": "1.4.3",
|
||||||
|
Reference in New Issue
Block a user