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


TypeScript vsotask.warning函數代碼示例

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


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

示例1: RegExp

}
tl.debug(`Using ${replaceRegex} as the replacement regex`);

var buildRegexObj = new RegExp(buildRegex);
if (buildRegexObj.test(buildNumber)) {
	var versionNum = buildRegexObj.exec(buildNumber)[0];
	console.info(`Using version ${versionNum} in folder ${sourcePath}`);
	
    // get a list of all files under this root
    var allFiles = tl.find(sourcePath);

    // Now matching the pattern against all files
    var filesToReplace = tl.match(allFiles, filePattern, { matchBase: true });
	
	if (filesToReplace === undefined || filesToReplace.length === 0) {
		tl.warning("No files found");
	} else {
		for(var i = 0; i < filesToReplace.length; i++){
			var file = filesToReplace[i];
			console.info(`  -> Changing version in ${file}`);
			
			// replace all occurrences by adding g to the pattern
			sh.sed("-i", new RegExp(replaceRegex, "g"), versionNum, file);
		}
		console.info(`Replaced version in ${filesToReplace.length} files`);
	}
} else {
	tl.warning(`Could not extract a version from [${buildNumber}] using pattern [${buildRegex}]`);
}

tl.debug("Leaving Version Assemblies step");
開發者ID:BigDataTechnology,項目名稱:cols-agent-tasks,代碼行數:31,代碼來源:versionAssemblies.ts

示例2: RegExp

tl.debug(`Using ${replaceRegex} as the replacement regex`);

if (buildRegexIndex === undefined || buildRegexIndex.length === 0){
	buildRegexIndex = "0";
}
tl.debug(`Using ${buildRegexIndex} as the build regex index regex`);

var buildRegexObj = new RegExp(buildRegex);
if (buildRegexObj.test(buildNumber)) {
	var versionNum = buildRegexObj.exec(buildNumber)[buildRegexIndex];
	console.info(`Using prefix [${replacePrefix}] and version [${versionNum}] in folder [${sourcePath}]`);
	
    var filesToReplace = tl.glob(`${sourcePath}\\${filePattern}`);
	
	if (filesToReplace === undefined || filesToReplace.length === 0) {
		tl.warning("No files found");
	} else {
		for (var i = 0; i < filesToReplace.length; i++) {
            var file = filesToReplace[i];
            console.info(`Changing version in ${file}`);
            
            var contents = fs.readFileSync(file, 'utf8').toString();
            var checkMatches = new RegExp(replaceRegex).exec(contents);
            if (!checkMatches || checkMatches.length === 0) {
                if (failIfNoMatchFound) {
                    tl.error(`No matches for regex [${replaceRegex}] found in file ${file}`);
                    process.exit(1);
                } else {
                    tl.warning(`No matches for regex [${replaceRegex}] found in file ${file}`);
                }
            } else {
開發者ID:dixu99,項目名稱:cols-agent-tasks,代碼行數:31,代碼來源:versionAssemblies.ts

示例3:

    var sourceDir = tl.getVariable("Agent.ReleaseDirectory");
    tl.cd(sourceDir);
    // create a new dir for the source
    tl.mkdirP("__s");
    tl.cd("__s");
    if (!ut.cloneRepo(repoUrl, pat)) {
        tl.exit(1);
    }
    // cd to the repo directory
    tl.cd(ut.findSubdirs(process.cwd())[0]);
    tl.debug(`Working dir: ${process.cwd()}`);
} else {
    tl.cd(sourceDir);
    // set the remote creds using the token
    if (ut.isEmpty(token)) {
        tl.warning("Could not find System.AccessToken. Attempting to continue - if credentials fail, then please enable the token in the build Options page.");
    } else {
        ut.setRemote(repoUrl, token, remoteName);
    }
}

// fetch the remote branches
if (ut.execGit(["fetch", remoteName]).code !== 0) {
    tl.exit(1);
}

if (mergeType === "test") {
    var branchesToMerge = branchesToMergeStr.split(',');
    console.info(`Found ${branchesToMerge.length} branches to test`);
    
    // pull all the branches that we're testing down so that they are locally
開發者ID:colindembovsky,項目名稱:vsts-gitmerge,代碼行數:31,代碼來源:merge.ts


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