// Make sure we JSON parse relevant config _.forEach(_.map(plugins, plugin => plugin.config), key => { if (typeof config[key] === 'string') { config[key] = JSON.parse(config[key]); } });
// Collect info so we can inject LANDO_INFO // // @TODO: this is not currently the full lando info because a lot of it requires // the app to be on app.events.on('post-init', 10, () => { const info = toObject(_.map(app.info, 'service'), {}); _.forEach(info, (value, key) => { info[key] = _.find(app.info, {service: key}); }); app.log.verbose('setting LANDO_INFO...'); app.env.LANDO_INFO = JSON.stringify(info); });
// This is a helper to take object data and break it into rows add(data, {joiner = this.joiner, sort = this.sort} = {}) { _.forEach(sort ? _.sortBy(_.keys(data)) : _.keys(data), key => { // Do some special things for arrays if (_.isArray(data[key])) data[key] = data[key].join(joiner); // Do something special for objects if (_.isObject(data[key])) data[key] = util.inspect(data[key], {compact: true}); // Do the normal push this.push([(chalk[this.keyColor](_.toUpper(key))), data[key]]); }); }
describe('art', () => { it('should return an object', () => { art.should.be.an('object'); }); _.forEach(_.keys(art), key => { it(`it should run ${key} without an error and return a string`, () => { const result = art[key](); result.should.be.a('string'); }); }); });
// Categorize and colorize URLS if and as appropriate _.forEach(app.info, info => { if (_.has(info, 'urls') && !_.isEmpty(info.urls)) { urls[info.service] = _.filter(app.urls, item => { item.theme = chalk[item.color](item.url); return _.includes(info.urls, item.url); }); } });
// If we have an app with a tooling section let's do this app.events.on('post-init', () => { if (!_.isEmpty(_.get(app, 'config.tooling', {}))) { app.log.verbose('additional tooling detected'); // Add the tasks after we init the app _.forEach(utils.getToolingTasks(app.config.tooling, app), task => { app.log.debug('adding app cli task %s', task.name); const injectable = _.has(app, 'engine') ? app : lando; app.tasks.push(buildTask(task, injectable)); }); } });
// Add in the hostname infos app.events.on('post-init', 1, () => { app.log.debug('adding hostnames to the app...'); _.forEach(app.info, data => { data.hostnames = _.get(data, 'hostnames', []); data.hostnames.push([data.service, app.project, 'internal'].join('.')); app.log.debug('hostnames added to %s', data.service, data.hostnames); }); });
// Check for docker compat warnings and surface them nicely as well app.events.on('post-start', () => { _.forEach(_(lando.versions).filter(version => version.dockerVersion).value(), thing => { if (!thing.satisfied) app.addWarning(warnings.unsupportedVersionWarning(thing)); }); });
_.forEach(types, type => { if (_.has(options, `config.${type}`)) { config[type] = options.config[type]; } else if (!_.has(options, `config.${type}`) && _.has(options, `defaultFiles.${type}`)) { if (_.has(options, 'confDest')) { config[type] = path.join(options.confDest, options.defaultFiles[type]); } } });
// Merge in process.env as relevant _.forEach(_.keys(config), key => { if (_.has(process.env, key)) { config[key] = process.env[key]; } });
// Clean _.forEach(cleanDirs, dir => { fs.emptyDirSync(dir); log.info('Cleaned up %s', dir); });
_.forEach(all, one => { if (_.has(one, 'options')) { _.forEach(one.options(lando), (option, key) => { // @TODO: get auto conflict assignment to work properly // @NOTE: maybe it doesn't and we should just do this manually? // _.set(options, `${key}.conflicts`, getConflicts(one.name, all, lando)); }); options = _.merge({}, one.options(lando), options); } });
// Merge in process.env as relevant _.forEach(_.keys(config), key => { if (_.has(process.env, key)) { config[key] = process.env[key]; } });
// Merge in process.env as relevant _.forEach(_.keys(config), key => { if (_.has(process.env, key)) { config[key] = process.env[key]; } });