Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
__load_cmds(cwd) {
var cmds = lazy.glob("*.js", { cwd: cwd });
_.each(cmds, (cmd) => {
require(path.join(cwd, cmd)).init(this);
});
}
_envs_from_file() {
var envs = {};
var file = path.join(this.manifest.manifestPath, '.env');
if (fs.existsSync(file)) {
var content = fs.readFileSync(file).toString();
_.each(content.split('\n'), (entry) => {
if (entry.match(/.*=.*/)) {
entry = entry.split('=');
envs[entry[0]] = entry[1];
}
});
}
return envs;
}
}
load(dir) {
_.each(glob.sync(path.join(dir, '**/*.js')), (file) => {
var Rule = require(file).Rule;
if (Rule) {
var rule = new Rule(this);
if (_.isArray(this.__rules[rule.type])) {
rule.name = path.basename(file, '.js');
this.__rules[rule.type].push(rule);
}
}
});
}
valid_requires(opts) {
var filter = (opt) => { return opt.required; };
var requireds = _.filter(this.options, filter);
requireds = requireds.concat(_.filter(this.stackable, filter));
_.each(requireds, (option) => {
if (!opts[option.name]) {
throw new RequiredOptionError(option.name);
}
});
}