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


TypeScript task.rmRF函數代碼示例

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


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

示例1: condaEnvironment

export async function condaEnvironment(parameters: Readonly<TaskParameters>, platform: Platform): Promise<void> {
    // Find Conda on the system
    const condaRoot = internal.findConda(platform);
    if (!condaRoot) {
        throw new Error(task.loc('CondaNotFound'));
    }

    internal.prependCondaToPath(condaRoot, platform);

    if (parameters.updateConda) {
        await internal.updateConda(condaRoot, platform);
    }

    if (parameters.createCustomEnvironment) { // activate the environment, creating it if it does not exist
        const environmentName = assertParameter(parameters.environmentName, 'environmentName');

        const environmentsDir = path.join(condaRoot, 'envs');
        const environmentPath = path.join(environmentsDir, environmentName);

        if (fs.existsSync(environmentPath) && !parameters.cleanEnvironment) {
            console.log(task.loc('ReactivateExistingEnvironment', environmentPath));
        } else { // create the environment
            if (fs.existsSync(environmentPath)) {
                console.log(task.loc('CleanEnvironment', environmentPath));
                task.rmRF(environmentPath);
            }
            await internal.createEnvironment(environmentPath, platform, parameters.packageSpecs, parameters.createOptions);
        }

        internal.activateEnvironment(environmentsDir, environmentName, platform);
    } else if (parameters.packageSpecs) {
        await internal.installPackagesGlobally(parameters.packageSpecs, platform, parameters.installOptions);
        internal.addBaseEnvironmentToPath(platform);
    }
}
開發者ID:shubham90,項目名稱:vsts-tasks,代碼行數:35,代碼來源:conda.ts

示例2: function

		coreApi.restClient.get(packageUrl, ApiVersion, null, { responseIsCollection: false }, async function (error, status, result) {
			if (!!error && status != 200) {
				reject(tl.loc("FailedToGetPackageMetadata", error));
			}

			var packageType = result.protocolType.toLowerCase();
			var packageName = result.name;

			if (packageType == "nuget") {
				var downloadUrl = await getDownloadUrl(coreApi.vsoClient, feedId, packageName, version);
				
				if (!tl.exist(downloadPath)) {
					tl.mkdirP(downloadPath);
				}

				var zipLocation = path.resolve(downloadPath, "/../", packageName) + ".zip";
				var unzipLocation = path.join(downloadPath, "");

				console.log(tl.loc("StartingDownloadOfPackage", packageName, zipLocation));
				await downloadNugetPackage(coreApi, downloadUrl, zipLocation);
				console.log(tl.loc("ExtractingNugetPackage", packageName, unzipLocation));
				await unzip(zipLocation, unzipLocation);
				
				if (tl.exist(zipLocation)) {
					tl.rmRF(zipLocation, false);
				}

				resolve();
			}
			else {
				reject(tl.loc("PackageTypeNotSupported"));
			}
		});
開發者ID:DarqueWarrior,項目名稱:vsts-tasks,代碼行數:33,代碼來源:download.ts

示例3: deleteSecureFile

 /**
  * Delete secure file from the temporary location for the build
  * @param secureFileId
  */
 deleteSecureFile(secureFileId: string): void {
     const tempDownloadPath: string = this.getSecureFileTempDownloadPath(secureFileId);
     if (tl.exist(tempDownloadPath)) {
         tl.debug('Deleting secure file at: ' + tempDownloadPath);
         tl.rmRF(tempDownloadPath);
     }
 }
開發者ID:grawcho,項目名稱:vso-agent-tasks,代碼行數:11,代碼來源:securefiles-common.ts

示例4: condaEnvironment

export async function condaEnvironment(parameters: Readonly<TaskParameters>, platform: Platform): Promise<void> {
    // Find Conda on the system
    const condaRoot = await (async () => {
        const preinstalledConda = internal.findConda(platform);
        if (preinstalledConda) {
            return preinstalledConda;
        } else {
            throw new Error(task.loc('CondaNotFound'));
        }
    })();

    if (parameters.updateConda) {
        await internal.updateConda(condaRoot, platform);
    }

    internal.prependCondaToPath(condaRoot, platform);

    // Activate the environment, creating it if it does not exist
    const environmentsDir = path.join(condaRoot, 'envs');
    const environmentPath = path.join(environmentsDir, parameters.environmentName);

    if (fs.existsSync(environmentPath) && !parameters.cleanEnvironment) {
        console.log(task.loc('ReactivateExistingEnvironment', environmentPath));
    } else { // create the environment
        if (fs.existsSync(environmentPath)) {
            console.log(task.loc('CleanEnvironment', environmentPath));
            task.rmRF(environmentPath);
        }
        await internal.createEnvironment(environmentPath, parameters.packageSpecs, parameters.createOptions);
    }

    internal.activateEnvironment(environmentsDir, parameters.environmentName, platform);
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:33,代碼來源:conda.ts

示例5: enableCodeCoverage

    function enableCodeCoverage(): Q.Promise<any> {
        if (!isCodeCoverageOpted) {
            return Q.resolve(true);
        }

        const classFilter: string = tl.getInput('classFilter');
        const classFilesDirectories: string = tl.getInput('classFilesDirectories', true);
        const sourceDirectories: string = tl.getInput('srcDirectories');
        // appending with small guid to keep it unique. Avoiding full guid to ensure no long path issues.
        const reportDirectoryName = "CCReport43F6D5EF";
        reportDirectory = path.join(buildRootPath, reportDirectoryName);
        const reportBuildFileName = "CCReportBuildA4D283EG.xml";
        reportBuildFile = path.join(buildRootPath, reportBuildFileName);
        let summaryFileName = "";
        if (ccTool.toLowerCase() == "jacoco") {
            summaryFileName = "summary.xml";
        }else if (ccTool.toLowerCase() == "cobertura") {
            summaryFileName = "coverage.xml";
        }
        summaryFile = path.join(buildRootPath, reportDirectoryName, summaryFileName);
        const coberturaCCFile = path.join(buildRootPath, "cobertura.ser");
        let instrumentedClassesDirectory = path.join(buildRootPath, "InstrumentedClasses");

        // clean any previous reports.
        try {
            tl.rmRF(coberturaCCFile);
            tl.rmRF(reportDirectory);
            tl.rmRF(reportBuildFile);
            tl.rmRF(instrumentedClassesDirectory);
        } catch (err) {
            tl.debug("Error removing previous cc files: " + err);
        }

        let buildProps: { [key: string]: string } = {};
        buildProps['buildfile'] = antBuildFile;
        buildProps['classfilter'] = classFilter
        buildProps['classfilesdirectories'] = classFilesDirectories;
        buildProps['sourcedirectories'] = sourceDirectories;
        buildProps['summaryfile'] = summaryFileName;
        buildProps['reportdirectory'] = reportDirectory;
        buildProps['ccreporttask'] = "CodeCoverage_9064e1d0"
        buildProps['reportbuildfile'] = reportBuildFile;

        let ccEnabler = new CodeCoverageEnablerFactory().getTool("ant", ccTool.toLowerCase());
        return ccEnabler.enableCodeCoverage(buildProps);
    }
開發者ID:grawcho,項目名稱:vso-agent-tasks,代碼行數:46,代碼來源:anttask.ts

示例6: run

export async function run(packagingLocation: PackagingLocation): Promise<void> {
    const workingDir = tl.getInput(NpmTaskInput.WorkingDir) || process.cwd();
    const npmrc = util.getTempNpmrcPath();
    const npmRegistry: INpmRegistry = await getPublishRegistry(packagingLocation);

    tl.debug(tl.loc('PublishRegistry', npmRegistry.url));
    util.appendToNpmrc(npmrc, `registry=${npmRegistry.url}\n`);
    util.appendToNpmrc(npmrc, `${npmRegistry.auth}\n`);

    // For publish, always override their project .npmrc
    const npm = new NpmToolRunner(workingDir, npmrc, true);
    npm.line('publish');

    npm.execSync();

    tl.rmRF(npmrc);
    tl.rmRF(util.getTempPath());
}
開發者ID:shubham90,項目名稱:vsts-tasks,代碼行數:18,代碼來源:npmpublish.ts

示例7: restoreFileWithName

export function restoreFileWithName(file: string, name: string, filePath: string): void {
    if (file) {
        let source = path.join(filePath, name + '.npmrc');
        if (tl.exist(source)) {
            tl.debug(tl.loc('RestoringFile', file));
            copyFile(source, file);
            tl.rmRF(source);
        }
    }
}
開發者ID:bleissem,項目名稱:vsts-tasks,代碼行數:10,代碼來源:util.ts

示例8: run

async function run() {
    tl.setResourcePath(path.join(__dirname, "task.json"));
    const pypircPath = tl.getVariable("PYPIRC_PATH");
    if (tl.exist(pypircPath)) {
        tl.debug(tl.loc("Info_RemovingPypircFile", pypircPath));
        tl.rmRF(pypircPath);
    }
    else {
        console.log(tl.loc("NoPypircFile"));
    }
}
開發者ID:shubham90,項目名稱:vsts-tasks,代碼行數:11,代碼來源:authcleanup.ts

示例9: run

export async function run(command?: string): Promise<void> {
    let workingDir = tl.getInput(NpmTaskInput.WorkingDir) || process.cwd();
    let npmrc = util.getTempNpmrcPath();
    let npmRegistries: INpmRegistry[] = await util.getLocalNpmRegistries(workingDir);

    let registryLocation = tl.getInput(NpmTaskInput.CustomRegistry);
    switch (registryLocation) {
        case RegistryLocation.Feed:
            tl.debug(tl.loc('UseFeed'));
            let feedId = tl.getInput(NpmTaskInput.CustomFeed, true);
            npmRegistries.push(await NpmRegistry.FromFeedId(feedId));
            break;
        case RegistryLocation.Npmrc:
            tl.debug(tl.loc('UseNpmrc'));
            let endpointIds = tl.getDelimitedInput(NpmTaskInput.CustomEndpoint, ',');
            if (endpointIds && endpointIds.length > 0) {
                let endpointRegistries = endpointIds.map(e => NpmRegistry.FromServiceEndpoint(e, true));
                npmRegistries = npmRegistries.concat(endpointRegistries);
            }
            break;
    }

    for (let registry of npmRegistries) {
        if (registry.authOnly === false) {
            tl.debug(tl.loc('UsingRegistry', registry.url));
            util.appendToNpmrc(npmrc, `registry=${registry.url}\n`);
        }

        tl.debug(tl.loc('AddingAuthRegistry', registry.url));
        util.appendToNpmrc(npmrc, `${registry.auth}\n`);
    }

    let npm = new NpmToolRunner(workingDir, npmrc);
    npm.line(command || tl.getInput(NpmTaskInput.CustomCommand, true));

    await npm.exec();

    tl.rmRF(npmrc);
    tl.rmRF(util.getTempPath());
}
開發者ID:colindembovsky,項目名稱:vsts-tasks,代碼行數:40,代碼來源:npmcustom.ts

示例10: restoreFile

export function restoreFile(file: string): void {
    if (file) {
        let tempPath = getTempPath();
        let baseName = path.basename(file);
        let source = path.join(tempPath, baseName);

        if (tl.exist(source)) {
            tl.debug(tl.loc('RestoringFile', file));
            copyFile(source, file);
            tl.rmRF(source);
        }
    }
}
開發者ID:colindembovsky,項目名稱:vsts-tasks,代碼行數:13,代碼來源:util.ts


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