constructor() { this._envs = _.reduce(process.env, function(map, val, key) { let name = _.replace(key, '_', '.'); name = _.toLower(name); return map.set(name, val); }, new Map()); }
static replaceTemplateValues(content, templateValues) { let convertedContent = content; _.forEach(templateValues, (value, key) => { convertedContent = _.replace(convertedContent, new RegExp(`{${key}}`, 'g'), value); }); return convertedContent; }
getReplacement(replacement) { return replacement.replace(/{{\s?([\w.-]+)\s?}}/g, ($0, $1) => { // eslint-disable-line if (_.startsWith($1, 'server')) { return _.reduce(_.split(_.replace($1, 'server.', ''), '.'), (o, i) => o[i], this.server.json); } else if (_.startsWith($1, 'env')) { return _.get(this.server.json, `build.env.${_.replace($1, 'env.', '')}`, ''); } else if (_.startsWith($1, 'config')) { return Config.get(_.replace($1, 'config.', '')); } return $0; }); }
const realPath = (reqId, location) => { let path = _.replace(Path.resolve(clientContext.server.path(), location), clientContext.server.path(), ''); if (_.startsWith(path, '/')) { path = path.substr(1); } return sftp.name(reqId, { filename: `/${path}`, longname: `drwxrwxrwx 2 foo foo 3 Dec 8 2009 /${path}`, attrs: {}, }); }
// assign parameter to query _assignParameter(query) { // add parameter to query for (var y in this.Parameter) { let params = this.Parameter[y] if (Array.isArray(params)) { params = params.join(",") } // replace . with dot for backup y = _.replace(y, /\./ig, "dot") // add param name let paramName = _.startCase(y) .replace(/\s/gi, "") .replace(/Dot/ig, ".") query[paramName] = params } return query }
this.systemCompress([_.replace(this.server.path(files), `${this.server.path()}/`, '')], Path.join(this.server.path(to), saveAsName), next); } else if (_.isArray(files)) { const FileEntries = []; FileEntries.push(_.replace(this.server.path(file), `${this.server.path()}/`, '')); eachCallback(); }, callback);
this.docker.stopWithSignal(_.replace(stopCommand, '^', '')).then(next).catch(next);
(commandsWithoutPms, command) => { command.task = _.replace(command.task, 'cross-env ', '') commandsWithoutPms[command.name] = setAbsolutePathsToTask( command,
newValue = _.replace(newValue, find, this.getReplacement(rep)); }); } else {
path(location) { const dataPath = Path.join(Config.get('sftp.path', '/srv/daemon-data'), this.json.uuid); if (_.isUndefined(location) || _.replace(location, /\s+/g, '').length < 1) { return dataPath;
newValue = _.replace(newValue, find, this.getReplacement(rep)); }); } else {
newValue = _.replace(newValue, find, this.getReplacement(rep)); }); } else {