• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript task.mkdirP函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vsts-task-lib/task.mkdirP函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mkdirP函数的具体用法?TypeScript mkdirP怎么用?TypeScript mkdirP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mkdirP函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: 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


示例2: acquireNodeFromFallbackLocation

// For non LTS versions of Node, the files we need (for Windows) are sometimes located
// in a different folder than they normally are for other versions.
// Normally the format is similar to: https://nodejs.org/dist/v5.10.1/node-v5.10.1-win-x64.7z
// In this case, there will be two files located at:
//      /dist/v5.10.1/win-x64/node.exe
//      /dist/v5.10.1/win-x64/node.lib
// If this is not the structure, there may also be two files located at:
//      /dist/v0.12.18/node.exe
//      /dist/v0.12.18/node.lib
// This method attempts to download and cache the resources from these alternative locations.
// Note also that the files are normally zipped but in this case they are just an exe
// and lib file in a folder, not zipped.
async function acquireNodeFromFallbackLocation(version: string): Promise<string> {
    // Create temporary folder to download in to
    let tempDownloadFolder: string = 'temp_' + Math.floor(Math.random() * 2000000000);
    let tempDir: string = path.join(taskLib.getVariable('agent.tempDirectory'), tempDownloadFolder);
    taskLib.mkdirP(tempDir);
    let exeUrl: string;
    let libUrl: string;
    try {
        exeUrl = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.exe`;
        libUrl = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.lib`;

        await toolLib.downloadTool(exeUrl, path.join(tempDir, "node.exe"));
        await toolLib.downloadTool(libUrl, path.join(tempDir, "node.lib"));
    }
    catch (err) {
        if (err['httpStatusCode'] && 
            err['httpStatusCode'] == 404)
        {
            exeUrl = `https://nodejs.org/dist/v${version}/node.exe`;
            libUrl = `https://nodejs.org/dist/v${version}/node.lib`;

            await toolLib.downloadTool(exeUrl, path.join(tempDir, "node.exe"));
            await toolLib.downloadTool(libUrl, path.join(tempDir, "node.lib"));
        }
        else {
            throw err;
        }
    }
    return await toolLib.cacheDir(tempDir, 'node', version);
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:42,代码来源:nodetool.ts


示例3: ensureDirExists

 private ensureDirExists(dirPath : string) : void
 {
     if (!fs.existsSync(dirPath)) {
         fs.mkdirSync(dirPath);
         var privateKeyDir= path.join(dirPath, "trust", "private");
         tl.mkdirP(privateKeyDir);
     }
 }
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:8,代码来源:containerconnection.ts


示例4: constructor

    constructor(packageType: string, installationPath: string) {
        try {
            tl.exist(installationPath) || tl.mkdirP(installationPath);
        }
        catch (ex) {
            throw tl.loc("UnableToAccessPath", installationPath, JSON.stringify(ex));
        }

        this.packageType = packageType;
        this.installationPath = installationPath;
    }
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:11,代码来源:versioninstaller.ts


示例5: getTempPath

export function getTempPath(): string {
    let tempNpmrcDir
        = tl.getVariable("Agent.BuildDirectory")
        || tl.getVariable("Agent.ReleaseDirectory")
        || process.cwd();
    let tempPath = path.join(tempNpmrcDir, "yarn");
    if (tl.exist(tempPath) === false) {
        tl.mkdirP(tempPath);
    }

    return tempPath;
}
开发者ID:asmundg,项目名称:gl-vsts-tasks-yarn,代码行数:12,代码来源:util.ts


示例6: getTempPath

export function getTempPath(): string {
    const tempNpmrcDir
        = tl.getVariable('Agent.BuildDirectory')
        || tl.getVariable('Agent.ReleaseDirectory')
        || process.cwd();
        const tempPath = path.join(tempNpmrcDir, 'npm');
    if (tl.exist(tempPath) === false) {
        tl.mkdirP(tempPath);
    }

    return tempPath;
}
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:12,代码来源:util.ts


示例7: acquireNodeFromFallbackLocation

// For non LTS versions of Node, the files we need (for Windows) are sometimes located
// in a different folder than they normally are for other versions.
// Normally the format is similar to: https://nodejs.org/dist/v5.10.1/node-v5.10.1-win-x64.7z
// In this case, there will be two files located at:
//      /dist/v5.10.1/win-x64/node.exe
//      /dist/v5.10.1/win-x64/node.lib
// This method attempts to download and cache the resources from this alternative location.
// Note also that the files are normally zipped but in this case they are just an exe
// and lib file in a folder, not zipped.
async function acquireNodeFromFallbackLocation(version: string): Promise<string> {
    let exeUrl: string = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.exe`;
    let libUrl: string = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.lib`;

    // Create temporary folder to download in to
    let tempDownloadFolder: string = 'temp_' + Math.floor(Math.random() * 2000000000);
    let tempDir: string = path.join(taskLib.getVariable('agent.tempDirectory'), tempDownloadFolder);
    taskLib.mkdirP(tempDir);

    let exeDownloadPath: string = await toolLib.downloadTool(exeUrl, path.join(tempDir, "node.exe"));
    let libDownloadPath: string = await toolLib.downloadTool(libUrl, path.join(tempDir, "node.lib"));

    return await toolLib.cacheDir(tempDir, 'node', version);
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:23,代码来源:nodetool.ts


示例8: getPypircPath

export function getPypircPath(): string {
    let pypircPath: string;
    if (tl.getVariable("PYPIRC_PATH")) {
        pypircPath = tl.getVariable("PYPIRC_PATH");
    }
    else {
       // tslint:disable-next-line:max-line-length
       let tempPath = tl.getVariable("Agent.BuildDirectory") || tl.getVariable("Agent.ReleaseDirectory") || process.cwd();
       tempPath = path.join(tempPath, "twineAuthenticate");
       tl.mkdirP(tempPath);
       let savePypircPath = fs.mkdtempSync(tempPath + path.sep);
       pypircPath = savePypircPath + path.sep + ".pypirc";
    }
    return pypircPath;
}
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:15,代码来源:utilities.ts


示例9: addDotNetCoreToolPath

function addDotNetCoreToolPath() {
    try {
        let globalToolPath: string = "";
        if (tl.osType().match(/^Win/)) {
            globalToolPath = path.join(process.env.USERPROFILE, Constants.relativeGlobalToolPath);
        } else {
            globalToolPath = path.join(process.env.HOME, Constants.relativeGlobalToolPath);
        }

        console.log(tl.loc("PrependGlobalToolPath"));
        tl.mkdirP(globalToolPath);
        toolLib.prependPath(globalToolPath);
    } catch (error) {
        //nop
        console.log(tl.loc("ErrorWhileSettingDotNetToolPath", JSON.stringify(error)));
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:17,代码来源:dotnetcoreinstaller.ts


示例10: install

    public async install() {
        // Check cache
        let toolPath: string;
        let osSuffixes = this.detectMachineOS();
        let parts = osSuffixes[0].split("-");
        this.arch = parts.length > 1 ? parts[1] : "x64";
        toolPath = this.getLocalTool();

        if (!toolPath) {
            // download, extract, cache
            console.log(tl.loc("InstallingAfresh"));
            console.log(tl.loc("GettingDownloadUrl", this.packageType, this.version));
            let downloadUrls = await DotNetCoreReleaseFetcher.getDownloadUrls(osSuffixes, this.version, this.packageType);
            toolPath = await this.downloadAndInstall(downloadUrls);
        } else {
            console.log(tl.loc("UsingCachedTool", toolPath));
        }

        // Prepend the tools path. instructs the agent to prepend for future tasks
        toolLib.prependPath(toolPath);

        try {
            let globalToolPath: string = "";
            if (tl.osType().match(/^Win/)) {
                globalToolPath = path.join(process.env.USERPROFILE, ".dotnet\\tools");
            } else {
                globalToolPath = path.join(process.env.HOME, ".dotnet/tools");
            }

            console.log(tl.loc("PrependGlobalToolPath"));
            tl.mkdirP(globalToolPath);
            toolLib.prependPath(globalToolPath);
        } catch (error) {
            //nop
        }

        // Set DOTNET_ROOT for dotnet core Apphost to find runtime since it is installed to a non well-known location.
        tl.setVariable('DOTNET_ROOT', toolPath);
    }
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:39,代码来源:dotnetcoreinstaller.ts



注:本文中的vsts-task-lib/task.mkdirP函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript task.osType函数代码示例发布时间:2022-05-25
下一篇:
TypeScript task.match函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap