// 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]]); }); }
// Merge in process.env as relevant _.forEach(_.keys(config), key => { if (_.has(process.env, key)) { config[key] = process.env[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'); }); }); });
_.map(overrides.volumes, volume => { if (!_.includes(volume, ':')) { return volume; } else { const local = exports.getHostPath(volume); const remote = _.last(volume.split(':')); // @TODO: I don't think below does anything? const excludes = _.keys(volumes).concat(_.keys(volumes)); const host = exports.normalizePath(local, base, excludes); return [host, remote].join(':'); } })
_(composeData) .flatMap(data => data.data) .flatMap(data => _.keys(data.services)) .uniq() .value()
// Set a different default if needed lando.events.on('cli-ssh-run', 2, data => { if (data.options.service === 'appserver') { // Discovery const services = _.keys(data.options._app.services); const hasRecipe = _.has(data, 'options._app.recipe'); // If this is not a recipe and we have no appserver container then set a new default if (!hasRecipe && !_.includes(services, 'appserver')) { data.options.service = _.first(services); data.options.s = data.options.service; } } });
// Assess whether we need to upgrade the lando network or not lando.events.on('pre-engine-start', 2, () => { if (lando.versions.networking === 1) { lando.log.warn('Version %s Landonet detected, attempting upgrade...', lando.versions.networking); const landonet = lando.engine.getNetwork(lando.config.networkBridge); // Remove the old network return landonet.inspect() .then(data => _.keys(data.Containers)) .each(id => landonet.disconnect({Container: id, Force: true})) .then(() => landonet.remove()) .catch(err => { lando.log.verbose('Error inspecting lando_bridge_network, probably does not exit yet'); lando.log.debug(err); }); } });
// Key find helper const getFirstKey = obj => _.first(_.keys(obj))
Promise.resolve(_.keys(docs.sections))
this.aggregationLevels = _.keys(this._aggregation); this.lowestAggregateTimeUnits = Number(this.aggregationLevels[0]); this.highestAggregationKey = _.last(this.aggregationLevels);
message: 'Choose relationships to push to platformsh', choices: () => { return _.keys(closestApp.relationships); }, when: () => !_.isEmpty(closestApp.relationships), message: 'Choose mounts to push to platformsh', choices: () => { return _.keys(closestApp.mounts); }, when: () => !_.isEmpty(closestApp.mounts),
// 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]; } });
// Merge in process.env as relevant _.forEach(_.keys(config), key => { if (_.has(process.env, key)) { config[key] = process.env[key]; } });