UNPKG

runas-core

Version:

The adhesive orchestrator

35 lines (30 loc) 1.21 kB
'use strict'; // Plugins: ['launcher', 'runas', 'fsutils'] const fs = require('fs'); module.exports = { //TODO: Mejorar esto 1) guardar el resultado en una variable global en lugar de escribir en disco 2) detectar (this.isLast) el último shot del straw y escribir entonces 'core-check': function() { const fileName = 'requirements.json'; let requirements = {}; if (this.params.saveRequirements) { if (this.params.requirements) { requirements = this.fsReadConfig(fileName); if (requirements.empty) { delete requirements.empty; } let tmp = {}; const reqTmp = this.runasConfig.mergeObject(this.params.versions, this.params.requirements); Object.getOwnPropertyNames(this.params.requirements).forEach((cmd) => { const options = reqTmp[cmd]; if (!options.installer) { tmp[cmd] = options; } }); requirements = this.runasConfig.mergeObject(requirements, tmp); fs.writeFileSync(fileName, JSON.stringify(requirements, null, 2)); } else if (!this.fsExists(fileName)) { fs.writeFileSync(fileName, JSON.stringify(requirements, null, 2)); } } } };