本文整理汇总了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);
}
}
示例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"));
}
});
示例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);
}
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
}
}
示例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"));
}
}
示例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());
}
示例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);
}
}
}