From 3182291aab05117088f5ed80fa8f556d2219e933 Mon Sep 17 00:00:00 2001 From: "Kristian D. Dimitrov" Date: Wed, 24 Apr 2019 19:55:31 +0300 Subject: [PATCH] feat: set signing for target that matches a one of the specified product types --- package.json | 2 +- xcode.ts | 27 ++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index bf459e8..f3870a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pbxproj-dom", - "version": "1.1.0", + "version": "1.2.0", "description": "", "main": "index.js", "devDependencies": { diff --git a/xcode.ts b/xcode.ts index 121c2ff..c2e9acb 100644 --- a/xcode.ts +++ b/xcode.ts @@ -61,11 +61,21 @@ export class Xcode { }); } + /** + * Sets Manual signing style for targets in the pbx.Document that match a specified product types. + */ setManualSigningStyleByTargetProductType(targetProductType: string, {team, uuid, name, identity}: ManualSigning = { team: undefined, uuid: undefined, name: undefined }) { + this.setManualSigningStyleByTargetProductTypesList([targetProductType], {team, uuid, name, identity}); + } + + /** + * Sets Manual signing style for targets in the pbx.Document that match one of the specified product types. + */ + setManualSigningStyleByTargetProductTypesList(targetProductTypesList: string[], {team, uuid, name, identity}: ManualSigning = { team: undefined, uuid: undefined, name: undefined }) { this.document.targets - .filter(target => target.productType === targetProductType) + .filter(target => targetProductTypesList.indexOf(target.productType) >= 0) .forEach(target => { - this.setTargetManualSigningStyle(target, {team, uuid, name, identity}) + this.setTargetManualSigningStyle(target, {team, uuid, name, identity}); }); } @@ -73,7 +83,7 @@ export class Xcode { this.document.targets .filter(target => target.key === targetKey) .forEach(target => { - this.setTargetManualSigningStyle(target, {team, uuid, name, identity}) + this.setTargetManualSigningStyle(target, {team, uuid, name, identity}); }); } @@ -89,11 +99,18 @@ export class Xcode { } /** - * Sets Automatic signing style for a target in the pbx.Document. + * Sets Automatic signing style for a target in the pbx.Document that match one of the specified product types. */ setAutomaticSigningStyleByTargetProductType(targetProductType: string, developmentTeam: string) { + this.setAutomaticSigningStyleByTargetProductTypesList([targetProductType], developmentTeam); + } + + /** + * Sets Automatic signing style for targets in the pbx.Document that match one of the specified product types. + */ + setAutomaticSigningStyleByTargetProductTypesList(targetProductTypesList: string[], developmentTeam: string) { this.document.targets - .filter(target => target.productType === targetProductType) + .filter(target => targetProductTypesList.indexOf(target.productType) >= 0) .forEach(target => { this.setTargetAutomaticSigningStyle(target, developmentTeam); });