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

TypeScript task.writeFile函数代码示例

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

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



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

示例1: createInstallationCompleteFile

    private createInstallationCompleteFile(versionInfo: VersionInfo): void {
        tl.debug(tl.loc("CreatingInstallationCompeleteFile", versionInfo.getVersion(), this.packageType));
        // always add for runtime as it is installed with sdk as well.
        var pathToVersionCompleteFile: string = "";
        if (this.packageType == utils.Constants.sdk) {
            let sdkVersion = versionInfo.getVersion();
            pathToVersionCompleteFile = path.join(this.installationPath, utils.Constants.relativeSdkPath, `${sdkVersion}.complete`);
            tl.writeFile(pathToVersionCompleteFile, `{ "version": "${sdkVersion}" }`);
        }

        let runtimeVersion = versionInfo.getRuntimeVersion();
        if (runtimeVersion) {
            pathToVersionCompleteFile = path.join(this.installationPath, utils.Constants.relativeRuntimePath, `${runtimeVersion}.complete`);
            tl.writeFile(pathToVersionCompleteFile, `{ "version": "${runtimeVersion}" }`);
        }
        else if (this.packageType == utils.Constants.runtime) {
            throw tl.loc("CannotFindRuntimeVersionForCompletingInstallation", this.packageType, versionInfo.getVersion());
        }
    }
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:19,代码来源:versioninstaller.ts


示例2: getmacOSProvisioningProfileType

export async function getmacOSProvisioningProfileType(provProfilePath: string) {
    let provProfileType: string;
    try {
        //find the provisioning profile details
        let provProfileDetails: string;
        let getProvProfileDetailsCmd: ToolRunner = tl.tool(tl.which('security', true));
        getProvProfileDetailsCmd.arg(['cms', '-D', '-i', provProfilePath]);
        getProvProfileDetailsCmd.on('stdout', function (data) {
            if (data) {
                if (provProfileDetails) {
                    provProfileDetails = provProfileDetails.concat(data.toString().trim().replace(/[,\n\r\f\v]/gm, ''));
                } else {
                    provProfileDetails = data.toString().trim().replace(/[,\n\r\f\v]/gm, '');
                }
            }
        })
        await getProvProfileDetailsCmd.exec();

        let tmpPlist: string;
        if (provProfileDetails) {
            //write the provisioning profile to a plist
            tmpPlist = '_xcodetasktmp.plist';
            tl.writeFile(tmpPlist, provProfileDetails);
        } else {
            throw tl.loc('ProvProfileDetailsNotFound', provProfilePath);
        }

        //get ProvisionsAllDevices - this will exist for developer-id profiles
        let provisionsAllDevices: string = await printFromPlist('ProvisionsAllDevices', tmpPlist);
        tl.debug('provisionsAllDevices = ' + provisionsAllDevices);
        if (provisionsAllDevices && provisionsAllDevices.trim().toLowerCase() === 'true') {
            //ProvisionsAllDevices = true in developer-id profiles
            provProfileType = 'developer-id';
        } else {
            let provisionedDevices: string = await printFromPlist('ProvisionedDevices', tmpPlist);
            if (!provisionedDevices) {
                // no provisioned devices means it is an app-store profile
                provProfileType = 'app-store';
            } else {
                // profile with provisioned devices - use development
                provProfileType = 'development';
            }
        }

        //delete the temporary plist file
        let deletePlistCommand: ToolRunner = tl.tool(tl.which('rm', true));
        deletePlistCommand.arg(['-f', tmpPlist]);
        await deletePlistCommand.exec();
    } catch (err) {
        tl.debug(err);
    }

    return provProfileType;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:54,代码来源:ios-signing-common.ts


示例3: getCommandsFile

function getCommandsFile(advinstCommands: string[]): string {
  let agentTempFolder: string = _getAgentTemp();
  const commandsFilePath = path.join(agentTempFolder, taskLib.getVariable('Build.BuildId') + '.aic');
  taskLib.debug("Commands file path: " + commandsFilePath);

  let commandFileContent: string[] = [';aic;'];
  commandFileContent = commandFileContent.concat(advinstCommands);
  taskLib.debug(commandFileContent.join('|'));
  taskLib.writeFile(commandsFilePath, commandFileContent.join('\r\n'));
  return commandsFilePath;
}
开发者ID:Caphyon,项目名称:advinst-vsts-task,代码行数:11,代码来源:AdvinstBuilder.ts


示例4: GetRegistries

export function GetRegistries(npmrc: string, saveNormalizedRegistries: boolean): string[] {
    let registries: string[] = [];
    let config = ini.parse(fs.readFileSync(npmrc).toString());

    for (let key in config) {
        let colonIndex = key.indexOf(':');
        if (key.substring(colonIndex + 1).toLowerCase() === 'registry') {
            config[key] = NormalizeRegistry(config[key]);
            registries.push(config[key]);
        }
    }

    if (saveNormalizedRegistries) {
        // save the .npmrc with normalized registries
        tl.writeFile(npmrc, ini.stringify(config));
    }
    return registries;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:18,代码来源:npmrcparser.ts


示例5: getCloudEntitlement

export async function getCloudEntitlement(provisioningProfilePath: string, exportMethod: string): Promise<string> {
    //find the provisioning profile details
    let provProfileDetails: string;
    const getProvProfileDetailsCmd: ToolRunner = tl.tool(tl.which('security', true));
    getProvProfileDetailsCmd.arg(['cms', '-D', '-i', provisioningProfilePath]);
    getProvProfileDetailsCmd.on('stdout', function (data) {
        if (data) {
            if (provProfileDetails) {
                provProfileDetails = provProfileDetails.concat(data.toString().trim().replace(/[,\n\r\f\v]/gm, ''));
            } else {
                provProfileDetails = data.toString().trim().replace(/[,\n\r\f\v]/gm, '');
            }
        }
    });

    await getProvProfileDetailsCmd.exec();

    let tmpPlist: string;
    if (provProfileDetails) {
        //write the provisioning profile to a plist
        tmpPlist = '_xcodetasktmp.plist';
        tl.writeFile(tmpPlist, provProfileDetails);
    } else {
        throw tl.loc('ProvProfileDetailsNotFound', provisioningProfilePath);
    }

    //use PlistBuddy to figure out if cloud entitlement exists.
    const cloudEntitlement: string = await printFromPlist('Entitlements:com.apple.developer.icloud-container-environment', tmpPlist);

    //delete the temporary plist file
    const deletePlistCommand: ToolRunner = tl.tool(tl.which('rm', true));
    deletePlistCommand.arg(['-f', tmpPlist]);
    await deletePlistCommand.exec();

    if (!cloudEntitlement) {
        return null;
    }

    tl.debug('Provisioning Profile contains cloud entitlement');
    return (exportMethod === 'app-store' || exportMethod === 'enterprise' || exportMethod === 'developer-id')
                ? "Production"
                : "Development";
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:43,代码来源:ios-signing-common.ts


示例6: getProvisioningProfileName

export async function getProvisioningProfileName(provProfilePath: string) {
    //find the provisioning profile UUID
    let provProfileDetails: string;
    let getProvProfileDetailsCmd: ToolRunner = tl.tool(tl.which('security', true));
    getProvProfileDetailsCmd.arg(['cms', '-D', '-i', provProfilePath]);
    getProvProfileDetailsCmd.on('stdout', function (data) {
        if (data) {
            if (provProfileDetails) {
                provProfileDetails = provProfileDetails.concat(data.toString().trim().replace(/[,\n\r\f\v]/gm, ''));
            } else {
                provProfileDetails = data.toString().trim().replace(/[,\n\r\f\v]/gm, '');
            }
        }
    })
    await getProvProfileDetailsCmd.exec();

    let tmpPlist: string;
    if (provProfileDetails) {
        //write the provisioning profile to a plist
        tmpPlist = '_xcodetasktmp.plist';
        tl.writeFile(tmpPlist, provProfileDetails);
    } else {
        throw tl.loc('ProvProfileDetailsNotFound', provProfilePath);
    }

    //use PlistBuddy to figure out the Name
    let provProfileName: string = await printFromPlist('Name', tmpPlist);

    //delete the temporary plist file
    let deletePlistCommand: ToolRunner = tl.tool(tl.which('rm', true));
    deletePlistCommand.arg(['-f', tmpPlist]);
    await deletePlistCommand.exec();

    tl.debug('getProvisioningProfileName: profile name = ' + provProfileName);
    return provProfileName;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:36,代码来源:ios-signing-common.ts


示例7: installProvisioningProfile

export async function installProvisioningProfile(provProfilePath: string) : Promise<{ provProfileUUID: string, provProfileName: string }> {
    //find the provisioning profile UUID
    let provProfileDetails: string;
    let getProvProfileDetailsCmd: ToolRunner = tl.tool(tl.which('security', true));
    getProvProfileDetailsCmd.arg(['cms', '-D', '-i', provProfilePath]);
    getProvProfileDetailsCmd.on('stdout', function (data) {
        if (data) {
            if (provProfileDetails) {
                provProfileDetails = provProfileDetails.concat(data.toString().trim().replace(/[,\n\r\f\v]/gm, ''));
            } else {
                provProfileDetails = data.toString().trim().replace(/[,\n\r\f\v]/gm, '');
            }
        }
    })
    await getProvProfileDetailsCmd.exec();

    let tmpPlist: string;
    if (provProfileDetails) {
        //write the provisioning profile to a plist
        tmpPlist = '_xcodetasktmp.plist';
        tl.writeFile(tmpPlist, provProfileDetails);
    } else {
        throw tl.loc('ProvProfileDetailsNotFound', provProfilePath);
    }

    //use PlistBuddy to figure out the UUID
    let provProfileUUID: string;
    let plist = tl.which('/usr/libexec/PlistBuddy', true);
    let plistTool: ToolRunner = tl.tool(plist);
    plistTool.arg(['-c', 'Print UUID', tmpPlist]);
    plistTool.on('stdout', function (data) {
        if (data) {
            provProfileUUID = data.toString().trim();
        }
    })
    await plistTool.exec();

    //use PlistBuddy to figure out the Name
    let provProfileName: string;
    plistTool = tl.tool(plist);
    plistTool.arg(['-c', 'Print Name', tmpPlist]);
    plistTool.on('stdout', function (data) {
        if (data) {
            provProfileName = data.toString().trim();
        }
    })
    await plistTool.exec();

    //delete the temporary plist file
    let deletePlistCommand: ToolRunner = tl.tool(tl.which('rm', true));
    deletePlistCommand.arg(['-f', tmpPlist]);
    await deletePlistCommand.exec();

    if (provProfileUUID) {
        //copy the provisioning profile file to ~/Library/MobileDevice/Provisioning Profiles
        tl.mkdirP(getUserProvisioningProfilesPath()); // Path may not exist if Xcode has not been run yet.
        let pathToProvProfile: string = getProvisioningProfilePath(provProfileUUID, provProfilePath);
        let copyProvProfileCmd: ToolRunner = tl.tool(tl.which('cp', true));
        copyProvProfileCmd.arg(['-f', provProfilePath, pathToProvProfile]);
        await copyProvProfileCmd.exec();

        if (!provProfileName) {
            tl.warning(tl.loc('ProvProfileNameNotFound'));
        }

        return { provProfileUUID, provProfileName };
    } else {
        throw tl.loc('ProvProfileUUIDNotFound', provProfilePath);
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:70,代码来源:ios-signing-common.ts


示例8: appendToNpmrc

export function appendToNpmrc(npmrc: string, data: string): void {
    tl.writeFile(npmrc, data, {
        flag: 'a'
    } as tl.FsOptions);
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:5,代码来源:npmutil.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript toolrunner.ToolRunner类代码示例发布时间:2022-05-25
下一篇:
TypeScript task.which函数代码示例发布时间: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