當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript vso-task-lib.warning函數代碼示例

本文整理匯總了TypeScript中vso-task-lib.warning函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript warning函數的具體用法?TypeScript warning怎麽用?TypeScript warning使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了warning函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: RegExp

	fs.readFile(file, 'utf8', (err, data) => {
		if (err) {
			tl.error(`Could not read file ${filePath}. Error is ${err.message}`);
			tl.exit(1);
		} 
		
		var reg = new RegExp(tokenRegex, "g");
		console.info(`Starting regex replacement in ${file}`);
		// loop through each match
		var match: RegExpExecArray;
		while((match = reg.exec(data)) !== null) {
			// find the variable value in the environment
			var varName = match[1];
			var varValue = tl.getVariable(varName);
			if (typeof varValue === 'undefined') {
				tl.warning(`... token ${varName} does not have an environment value`);
			} else {
				data = data.replace(match[0], varValue);
				tl.debug(`... replaced token ${varName}`);
			}
		}
		console.info("Writing new values to file");
		fs.writeFileSync(file, data);
		
		tl.debug("Leaving Replace Tokens step");
	});
開發者ID:BigDataTechnology,項目名稱:cols-agent-tasks,代碼行數:26,代碼來源:replaceTokens.ts

示例2: RegExp

	
	var contents = fs.readFileSync(file, 'utf8').toString();
    var reg = new RegExp(tokenRegex, "g");
            
    // loop through each match
    var match: RegExpExecArray;
    while((match = reg.exec(contents)) !== null) {
        var vName = match[1];
        if (typeof secretTokens[vName.toLowerCase()] !== "undefined") {
			// try find the variable in secret tokens input first
            contents = contents.replace(match[0], secretTokens[vName.toLowerCase()]);
            tl.debug(`Replaced token [${vName}] with a secret value`);
        } else {
			// find the variable value in the environment
            var vValue = tl.getVariable(vName);
            if (typeof vValue === 'undefined') {
                tl.warning(`Token [${vName}] does not have an environment value`);
            } else {
                contents = contents.replace(match[0], vValue);
                tl.debug(`Replaced token [${vName }]`);
            }           
        }
    }
    console.info("Writing new values to file");
    
    // make the file writable
    sh.chmod(666, file);
    fs.writeFileSync(file, contents);
}

tl.debug("Leaving Replace Tokens task");
開發者ID:nphmuller,項目名稱:cols-agent-tasks,代碼行數:30,代碼來源:replaceTokens.ts

示例3: if

    }

    return count;
}

// contents is a multiline input containing glob patterns
var contents: string[] = tl.getDelimitedInput('Contents', '\n');
var artifactName: string = tl.getInput('ArtifactName');
var artifactType: string = tl.getInput('ArtifactType');
// targetPath is used for file shares
var targetPath: string = tl.getInput('TargetPath');
var findRoot: string = tl.getPathInput('CopyRoot');

if (!artifactName) {
    // nothing to do
    tl.warning('Artifact name is not specified.');
}
else if (!artifactType) {
    // nothing to do
    tl.warning('Artifact type is not specified.');
}
else {
    artifactType = artifactType.toLowerCase();
    // back compat. remove after 82
    if (artifactType === "localpath") {
        artifactType = "filepath";
    }
    
    var stagingFolder: string = tl.getVariable('build.stagingdirectory');
    stagingFolder = path.join(stagingFolder, artifactName);
    
開發者ID:AnubhavAggarwal,項目名稱:vso-agent-tasks,代碼行數:30,代碼來源:publishBuildArtifacts.ts


注:本文中的vso-task-lib.warning函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。