本文整理汇总了TypeScript中azure-pipelines-task-lib/task.rmRF函数的典型用法代码示例。如果您正苦于以下问题:TypeScript rmRF函数的具体用法?TypeScript rmRF怎么用?TypeScript rmRF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rmRF函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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);
}
}
示例2: run
export async function run(packagingLocation: PackagingLocation): Promise<void> {
const workingDir = tl.getInput(NpmTaskInput.WorkingDir) || process.cwd();
const npmrc = npmutil.getTempNpmrcPath();
const npmRegistry: INpmRegistry = await getPublishRegistry(packagingLocation);
tl.debug(tl.loc('PublishRegistry', npmRegistry.url));
npmutil.appendToNpmrc(npmrc, `registry=${npmRegistry.url}\n`);
npmutil.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());
}
示例3: restoreFileWithName
export function restoreFileWithName(file: string, name: string, filePath: string): void {
if (file) {
const source = path.join(filePath, name + '.npmrc');
if (tl.exist(source)) {
tl.debug(tl.loc('RestoringFile', file));
copyFile(source, file);
tl.rmRF(source);
}
}
}
示例4: 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"));
}
}
示例5: restoreFile
export function restoreFile(file: string): void {
if (file) {
const tempPath = getTempPath();
const baseName = path.basename(file);
const source = path.join(tempPath, baseName);
if (tl.exist(source)) {
tl.debug(tl.loc('RestoringFile', file));
copyFile(source, file);
tl.rmRF(source);
}
}
}
示例6: function
feedConnection.getCoreApi().restClient.get(packageUrl, ApiVersion, null, { responseIsCollection: false }, async function (error, status, result) {
if (!!error || status != 200) {
return reject(tl.loc("FailedToGetPackageMetadata", error));
}
var packageType = result.protocolType.toLowerCase();
var packageName = result.name;
if (packageType == "nuget") {
var getDownloadUrlPromise = getDownloadUrl(packageConnection.getCoreApi().vsoClient, feedId, packageName, version)
getDownloadUrlPromise.catch((error) => {
return reject(error)
});
var downloadUrl = await getDownloadUrlPromise;
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));
var downloadNugetPackagePromise = downloadNugetPackage(packageConnection.getCoreApi(), downloadUrl, zipLocation);
downloadNugetPackagePromise.catch((error) => {
return reject(error)
});
await downloadNugetPackagePromise;
console.log(tl.loc("ExtractingNugetPackage", packageName, unzipLocation));
var unzipPromise = unzip(zipLocation, unzipLocation);
unzipPromise.catch((error) => {
return reject(error)
});
await unzipPromise;
if (tl.exist(zipLocation)) {
tl.rmRF(zipLocation);
}
return resolve();
}
else {
return reject(tl.loc("PackageTypeNotSupported"));
}
});
示例7: run
export async function run(packagingLocation: PackagingLocation, command?: string): Promise<void> {
const workingDir = tl.getInput(NpmTaskInput.WorkingDir) || process.cwd();
const npmrc = npmutil.getTempNpmrcPath();
const npmRegistries: INpmRegistry[] = await getCustomRegistries(packagingLocation);
const overrideNpmrc = (tl.getInput(NpmTaskInput.CustomRegistry) === RegistryLocation.Feed) ? true : false;
for (const registry of npmRegistries) {
if (registry.authOnly === false) {
tl.debug(tl.loc('UsingRegistry', registry.url));
npmutil.appendToNpmrc(npmrc, `registry=${registry.url}\n`);
}
tl.debug(tl.loc('AddingAuthRegistry', registry.url));
npmutil.appendToNpmrc(npmrc, `${registry.auth}\n`);
}
const npm = new NpmToolRunner(workingDir, npmrc, overrideNpmrc);
npm.line(command || tl.getInput(NpmTaskInput.CustomCommand, true));
npm.execSync();
tl.rmRF(npmrc);
tl.rmRF(util.getTempPath());
}
示例8: run
async function run() {
tl.setResourcePath(path.join(__dirname, 'task.json'));
let indexFile = path.join(tl.getVariable("SAVE_NPMRC_PATH"), 'index.json');
if (tl.exist(indexFile)) {
let indexFileText = fs.readFileSync(indexFile, 'utf8');
let jsonObject = JSON.parse(indexFileText);
let npmrcIndex = JSON.stringify(jsonObject[tl.getInput(constants.NpmAuthenticateTaskInput.WorkingFile)]);
util.restoreFileWithName(tl.getInput(constants.NpmAuthenticateTaskInput.WorkingFile), npmrcIndex, tl.getVariable("SAVE_NPMRC_PATH"));
console.log(tl.loc("RevertedChangesToNpmrc", tl.getInput(constants.NpmAuthenticateTaskInput.WorkingFile)));
if (fs.readdirSync(tl.getVariable("SAVE_NPMRC_PATH")).length == 1) {
tl.rmRF(tl.getVariable("NPM_AUTHENTICATE_TEMP_DIRECTORY"));
}
}
else {
console.log(tl.loc("NoIndexJsonFile"));
}
}
示例9: run
async function run() {
try {
if (taskLib.osType() != 'Windows_NT')
throw new Error('Only Windows systems are supported.');
const performCleanup: string = taskLib.getVariable('advinst.cleanup');
taskLib.debug('advinst.cleanup = ' + performCleanup);
if (!performCleanup) {
return;
}
let licensePath = path.join(taskLib.getVariable('ProgramData'), 'Caphyon\\Advanced Installer\\license80.dat');
if (taskLib.exist(licensePath)) {
taskLib.rmRF(licensePath);
}
}
catch (error) {
taskLib.setResult(taskLib.TaskResult.Failed, error.message);
}
}
示例10: reject
await new Promise<void>(function (resolve, reject) {
if (tl.exist(unzipLocation)) {
tl.rmRF(unzipLocation);
}
tl.debug('Extracting ' + zipLocation + ' to ' + unzipLocation);
var unzipper = new DecompressZip(zipLocation);
unzipper.on('error', err => {
return reject(tl.loc("ExtractionFailed", err))
});
unzipper.on('extract', log => {
tl.debug('Extracted ' + zipLocation + ' to ' + unzipLocation + ' successfully');
return resolve();
});
unzipper.extract({
path: unzipLocation
});
});