_(_.flatten([...sources])) .sortBy('date') .groupBy('email') .map(tokens => _.last(tokens)) .value()
// 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)); }); });
lando.engine.list(options) // Map each app to a summary and print results .then(containers => console.log(lando.cli.formatData( _(containers) .map(container => _.omit(container, ['lando', 'id', 'instance'])) .value(), options )))
/* * Wipe the ENTIRE data source */ delete(source, id) { if (!id) throw Error('Specify a resource ID to remove!'); const database = _(this.read(source)).filter(item => item.id !== id).value(); this.yaml.dump(path.resolve(this.base, `${source}.yml`), database); return id; }
_(fs.readdirSync(baseDir, {withFileTypes: true})) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) .concat('.') .map(directory => path.resolve(baseDir, directory, '.platform.app.yaml')) .filter(file => fs.existsSync(file)) .map(file => ({data: yamlPlatform.load(fs.readFileSync(file)), file})) .map(data => ({name: data.data.name, file: data.file, dir: path.dirname(data.file)})) .value()
// Helper to get tokens const getTokens = (home, tokens = []) => _(utils.sortTokens(utils.getTerminusTokens(home), tokens)) .map(token => ({name: token.email, value: token.token})) .thru(tokens => tokens.concat([{name: 'add or refresh a token', value: 'more'}])) .value()
_(composeData) .flatMap(data => data.data) .flatMap(data => _.keys(data.services)) .uniq() .value()
_(config.LANDO_METRICS_PLUGINS) .map(plugin => _.merge({}, plugin, {path: path.resolve(__dirname, 'plugins', `${plugin.name}.js`)})) .filter(plugin => fs.existsSync(plugin.path)) .map(plugin => _.merge({}, plugin, {Reporter: require(plugin.path)})) .value()
// Helper to get init source config const getInitSourceConfig = dirs => _(dirs) .filter(dir => fs.existsSync(dir)) .flatMap(dir => glob.sync(path.join(dir, '*.js'))) .map(file => require(file)) .flatMap(source => source.sources) .value()
// Helper to get init config const getInitConfig = dirs => _(dirs) .filter(dir => fs.existsSync(dir)) .flatMap(dir => glob.sync(path.join(dir, '*', 'init.js'))) .map(file => require(file)) .value()
_(urls) .map(url => exports.parseUrl(url)) .map(parsedUrl => _.merge({}, parsedUrl, {id: hasher(parsedUrl)})) .uniqBy('id') .value()
/* * Helper to find containers that serve */ const getOtherServingContainers = services => _(services) .filter(service => service.type === 'lagoon-varnish') .map('name') .value()
/* * Helper to get passthru options */ const handlePassthruOpts = (options = {}, answers = {}) => _(options) .map((value, key) => _.merge({}, {name: key}, value)) .filter(value => value.passthrough === true && !_.isNil(answers[value.name])) .map(value => `--${value.name}=${answers[value.name]}`) .value()
// Helper to get tokens const getTokens = (home, tokens = []) => _(utils.sortTokens(utils.getPlatformshTokens(home), tokens)) .map(token => ({name: token.email, value: token.token})) .thru(tokens => tokens.concat([{name: 'add or refresh a token', value: 'more'}])) .value()
_(_.flatten([...sources])) .sortBy('date') .groupBy('email') .map(tokens => _.last(tokens)) .value()