public getDockerConfig(): string { var authenticationToken = new Buffer(this.username+":"+this.password).toString('base64') console.log("##vso[task.setvariable variable=CONTAINER_AUTHENTICATIONTOKEN;issecret=true;]" + authenticationToken); var auths = util.format('{"auths": { "%s": {"auth": "%s", "email": "%s" } }, "HttpHeaders":{"X-Meta-Source-Client":"%s"} }', this.registry, authenticationToken,this.email, this.xMetaSourceClient); return auths; }
warn(firstArg: any, ...rest: Array<any>) { this._log('warn', format(firstArg, ...rest)); }
var workingDirectory = tl.getInput('wd', true); var serviceEndpointId = tl.getInput('serviceEndpoint', true); var wheel: boolean = tl.getBoolInput('wheel'); var homedir = os.homedir(); var pypircFilePath = path.join(homedir, ".pypirc"); var pythonToolPath = tl.which('python', true); var error = ''; //Generic service endpoint var pythonServer = tl.getEndpointUrl(serviceEndpointId, false); var username = tl.getEndpointAuthorizationParameter(serviceEndpointId, 'username', false); var password = tl.getEndpointAuthorizationParameter(serviceEndpointId, 'password', false); //Create .pypirc file var text = util.format("[distutils] \nindex-servers =\n pypi \n[pypi] \nrepository=%s \nusername=%s \npassword=%s", pythonServer, username, password); tl.writeFile(pypircFilePath, text, 'utf8'); (async () => { //PyPI upload try{ tl.cd(workingDirectory); await executePythonTool("-m pip install twine --user"); await executePythonTool("setup.py sdist"); if(wheel){ await executePythonTool("-m pip install wheel --user"); await executePythonTool("setup.py bdist_wheel --universal"); } await executePythonTool("-m twine upload dist/*"); } catch(err){
onRunComplete(contexts: Set<Context>, result: AggregatedResult): void { const success = result.numFailedTests === 0 && result.numRuntimeErrorTestSuites === 0; const firstContext = contexts.values().next(); const hasteFS = firstContext && firstContext.value && firstContext.value.hasteFS; let packageName; if (hasteFS != null) { // assuming root package.json is the first one const [filePath] = hasteFS.matchFiles('package.json'); packageName = filePath != null ? hasteFS.getModuleName(filePath) : this._globalConfig.rootDir; } else { packageName = this._globalConfig.rootDir; } packageName = packageName != null ? `${packageName} - ` : ''; const notifyMode = this._globalConfig.notifyMode; const statusChanged = this._context.previousSuccess !== success || this._context.firstRun; const testsHaveRun = result.numTotalTests !== 0; if ( testsHaveRun && success && (notifyMode === 'always' || notifyMode === 'success' || notifyMode === 'success-change' || (notifyMode === 'change' && statusChanged) || (notifyMode === 'failure-change' && statusChanged)) ) { const title = util.format('%s%d%% Passed', packageName, 100); const message = util.format( (isDarwin ? '\u2705 ' : '') + '%d tests passed', result.numPassedTests, ); notifier.notify({icon, message, title}); } else if ( testsHaveRun && !success && (notifyMode === 'always' || notifyMode === 'failure' || notifyMode === 'failure-change' || (notifyMode === 'change' && statusChanged) || (notifyMode === 'success-change' && statusChanged)) ) { const failed = result.numFailedTests / result.numTotalTests; const title = util.format( '%s%d%% Failed', packageName, Math.ceil(Number.isNaN(failed) ? 0 : failed * 100), ); const message = util.format( (isDarwin ? '\u26D4\uFE0F ' : '') + '%d of %d tests failed', result.numFailedTests, result.numTotalTests, ); const watchMode = this._globalConfig.watch || this._globalConfig.watchAll; const restartAnswer = 'Run again'; const quitAnswer = 'Exit tests'; if (!watchMode) { notifier.notify({ icon, message, title, }); } else { notifier.notify( { actions: [restartAnswer, quitAnswer], closeLabel: 'Close', icon, message, title, }, (err, _, metadata) => { if (err || !metadata) { return; } if (metadata.activationValue === quitAnswer) { exit(0); return; } if (metadata.activationValue === restartAnswer) { this._startRun(this._globalConfig); } }, ); } } this._context.previousSuccess = success; this._context.firstRun = false; }
function print_stat() { t2 = Date.now(); const str = util.format("R= %d W= %d T=%d t= %d", client.bytesRead, client.bytesWritten, client.transactionsPerformed, (t2 - t1)); console.log(chalk.yellow.bold(str)); }
export function TOO_COMPLEX() { let fmt = `Method table is too complex. Try reducing the number of predicates or their degree of overlap.`; return error(format(fmt)); }
export function DUPLICATE_PREDICATE(normalised: string, predicates: string) { let fmt = `The predicate '%s' is duplicated across multiple methods: %s. To resolve this, use a method chain.`; return error(format(fmt, normalised, predicates)); }
export function INVALID_ARITY_OPTION(value: any) { let fmt = `Expected a positive integer or undefined value for options.arity, but found %j.`; return error(format(fmt, value)); }
export function INVALID_NAME_OPTION(value: any) { let fmt = `Expected a valid identifier or undefined value for options.name, but found %j.`; return error(format(fmt, value)); }
constructor(private $dynamicHelpService: IDynamicHelpService, private $injector: IInjector) { // Injector's dynamicCallRegex doesn't have 'g' option, which we need here. // Use ( ) in order to use $1 to get whole expression later this.dynamicCallRegex = new RegExp(util.format("(%s)", this.$injector.dynamicCallRegex.source), "g"); }