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;
}
}
getSystemsByName(names) {
var systems_name = this.systemsInOrder();
if (!_.isEmpty(names)) {
names = _.isArray(names) ? names : names.split(',');
_.each(names, (name) => this.system(name, true));
systems_name = _.intersection(systems_name, names);
}
return _.reduce(systems_name, (systems, name) => {
systems.push(this.system(name, true));
return systems;
}, []);
}
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);
}
});
}
var generateAndReturnManifest = (project) => {
var manifest = path.join(project, config('manifest'));
return generator.findSystems(project).then(function (all_systems) {
return generator.render({ systems: all_systems }, manifest).then(function() {
return new Manifest(project);
});
});
};
var generateAndReturnManifest = (folder) => {
var manifest = path.join(folder, config('manifest'));
return generator.findSystems(folder).then(function (all_systems) {
return generator.render({ systems: all_systems }, manifest).then(function() {
return new Manifest(folder);
});
});
};
var generate_manifest = (dir, data) => {
var file = path.join(dir, config('manifest'));
return generator.render(data, file).then(function() {
var manifest = new Manifest(dir);
return manifest;
});
};
var generateAndReturnManifest = (project) => {
var manifest = path.join(project, config('manifest'));
generator.render({
systems: generator.findSystems(project),
}, manifest);
return new Manifest(project);
};
var generateAndReturnManifest = (project) => {
var manifest = path.join(project, config('manifest'));
return generator.findSystems(project)
.then(function (all_systems) {
return generator.render({ systems: all_systems }, manifest)
.then(function() {
return new Manifest(project);
});
});
};