本文整理汇总了TypeScript中vsts-task-lib/task.writeFile函数的典型用法代码示例。如果您正苦于以下问题:TypeScript writeFile函数的具体用法?TypeScript writeFile怎么用?TypeScript writeFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeFile函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: GetRegistries
export function GetRegistries(npmrc: string): 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]);
}
}
// save the .npmrc with normalized registries
tl.writeFile(npmrc, ini.stringify(config));
return registries;
}
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:16,代码来源:npmrcparser.ts
示例3: executePythonTool
var workingDirectory = tl.getInput('wd', true);
var serviceEndpointId = tl.getInput('serviceEndpoint', true);
var wheel: boolean = tl.getBoolInput('wheel');
var homedir = os.homedir();
var pypircFilePath = path.join(homedir, ".pypirc");
var pythonToolPath = tl.which('python', true);
var error = '';
//Generic service endpoint
var pythonServer = tl.getEndpointUrl(serviceEndpointId, false);
var username = tl.getEndpointAuthorizationParameter(serviceEndpointId, 'username', false);
var password = tl.getEndpointAuthorizationParameter(serviceEndpointId, 'password', false);
//Create .pypirc file
var text = util.format("[distutils] \nindex-servers =\n pypi \n[pypi] \nrepository=%s \nusername=%s \npassword=%s", pythonServer, username, password);
tl.writeFile(pypircFilePath, text, 'utf8');
(async () => {
//PyPI upload
try{
tl.cd(workingDirectory);
await executePythonTool("-m pip install twine --user");
await executePythonTool("setup.py sdist");
if(wheel){
await executePythonTool("-m pip install wheel --user");
await executePythonTool("setup.py bdist_wheel --universal");
}
await executePythonTool("-m twine upload dist/*");
}
catch(err){
tl.setResult(tl.TaskResult.Failed, error);
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:31,代码来源:publisher.ts
示例4: appendToNpmrc
export function appendToNpmrc(npmrc: string, data: string): void {
tl.writeFile(npmrc, data, {
flag: 'a'
} as tl.FsOptions);
}
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:5,代码来源:npmutil.ts
注:本文中的vsts-task-lib/task.writeFile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论