本文整理匯總了TypeScript中azure-pipelines-task-lib/toolrunner.ToolRunner.arg方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ToolRunner.arg方法的具體用法?TypeScript ToolRunner.arg怎麽用?TypeScript ToolRunner.arg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類azure-pipelines-task-lib/toolrunner.ToolRunner
的用法示例。
在下文中一共展示了ToolRunner.arg方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getWorkspaceSchemes
export async function getWorkspaceSchemes(xcbuild: string, workspace: string) : Promise<string[]> {
let xcv: ToolRunner = tl.tool(xcbuild);
xcv.arg(['-workspace', workspace]);
xcv.arg('-list');
let schemes: string[] = [];
let inSchemesSection = false;
let output = '';
xcv.on('stdout', (data) => {
output = output + data.toString();
});
await xcv.exec();
output.split('\n').forEach((line: string) => {
tl.debug(`Line: ${line}`);
line = line.trim();
if (inSchemesSection) {
if (line !== '') {
tl.debug(`Scheme: ${line}`);
schemes.push(line);
}
else {
inSchemesSection = false;
}
}
else if (line === 'Schemes:') {
inSchemesSection = true;
}
});
return schemes;
}
示例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;
}
示例3: deleteKeychain
export async function deleteKeychain(keychainPath: string): Promise<void> {
if (tl.exist(keychainPath)) {
let deleteKeychainCommand: ToolRunner = tl.tool(tl.which('security', true));
deleteKeychainCommand.arg(['delete-keychain', keychainPath]);
await deleteKeychainCommand.exec();
}
}
示例4: acquireTfx
async function acquireTfx(version: string): Promise<string> {
try{
version = toolLib.cleanVersion(version);
let extPath: string;
taskLib.assertAgent('2.115.0');
extPath = taskLib.getVariable('Agent.TempDirectory');
if (!extPath) {
throw new Error('Expected Agent.TempDirectory to be set');
}
extPath = path.join(extPath, 'tfx'); // use as short a path as possible due to nested node_modules folders
taskLib.mkdirP(path.join(extPath));
const npmRunner = new tr.ToolRunner("npm");
npmRunner.arg(["install", "tfx-cli@" + version, "--prefix", extPath]);
const result = npmRunner.execSync({ failOnStdErr: false, silent: true, ignoreReturnCode: false} as tr.IExecOptions);
if (result.code === 0)
{
if (os.platform() === "win32")
{
fs.unlinkSync(path.join(extPath, "/tfx"));
}
return await toolLib.cacheDir(extPath, 'tfx', version);
}
}
catch {
return Promise.reject(new Error("Failed to install tfx"));
}
}
示例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";
}
示例6: getP12PrivateKeyName
export async function getP12PrivateKeyName(p12Path: string, p12Pwd: string): Promise<string> {
//openssl pkcs12 -in <p12Path> -nocerts -passin pass:"<p12Pwd>" -passout pass:"<p12Pwd>" | grep 'friendlyName'
tl.debug('getting the P12 private key name');
const opensslPath: string = tl.which('openssl', true);
const openssl: ToolRunner = tl.tool(opensslPath);
if (!p12Pwd) {
// if password is null or not defined, set it to empty
p12Pwd = '';
}
// since we can't suppress the private key bytes, encrypt them before we pass them to grep.
const privateKeyPassword = p12Pwd ? p12Pwd : generatePassword();
openssl.arg(['pkcs12', '-in', p12Path, '-nocerts', '-passin', 'pass:' + p12Pwd, '-passout', 'pass:' + privateKeyPassword]);
//we pipe through grep so we we don't log the private key to the console.
//even if it's encrypted, it's noise and could cause concern for some users.
const grepPath: string = tl.which('grep', true);
const grep: ToolRunner = tl.tool(grepPath);
grep.arg(['friendlyName']);
openssl.pipeExecOutputToTool(grep);
let privateKeyName: string;
openssl.on('stdout', function (data) {
if (data) {
// find the private key name
data = data.toString().trim();
const match = data.match(/friendlyName: (.*)/);
if (match && match[1]) {
privateKeyName = match[1].trim();
}
}
});
await openssl.exec();
tl.debug('P12 private key name = ' + privateKeyName);
if (!privateKeyName) {
throw new Error(tl.loc('P12PrivateKeyNameNotFound', p12Path));
}
return privateKeyName;
}
示例7: getDefaultKeychainPath
export async function getDefaultKeychainPath() {
let defaultKeychainPath: string;
let getKeychainCmd: ToolRunner = tl.tool(tl.which('security', true));
getKeychainCmd.arg('default-keychain');
getKeychainCmd.on('stdout', function (data) {
if (data) {
defaultKeychainPath = data.toString().trim().replace(/[",\n\r\f\v]/gm, '');
}
})
await getKeychainCmd.exec();
return defaultKeychainPath;
}
示例8: queryLatestMatch
function queryLatestMatch(versionSpec: string): string {
const npmRunner = new tr.ToolRunner("npm");
npmRunner.arg(["show", "tfx-cli", "versions", "--json"]);
const result = npmRunner.execSync({ failOnStdErr: false, silent: true, ignoreReturnCode: false} as tr.IExecOptions);
if (result.code === 0)
{
let versions: string[] = JSON.parse(result.stdout.trim());
let version: string = toolLib.evaluateVersions(versions, versionSpec);
return version;
}
return "";
}
示例9: deleteProvisioningProfile
export async function deleteProvisioningProfile(uuid: string): Promise<void> {
if (uuid && uuid.trim()) {
const provProfiles: string[] = tl.findMatch(getUserProvisioningProfilesPath(), uuid.trim() + '*');
if (provProfiles) {
for (const provProfilePath of provProfiles) {
console.log('Deleting provisioning profile: ' + provProfilePath);
if (tl.exist(provProfilePath)) {
const deleteProfileCommand: ToolRunner = tl.tool(tl.which('rm', true));
deleteProfileCommand.arg(['-f', provProfilePath]);
await deleteProfileCommand.exec();
}
}
}
}
}
示例10: 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;
}