pbxproj-dom
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -33,2 +33,3 @@ export declare type Kind = "Document" | "Dictionary" | "KeyValuePair" | "StringBlock" | "CommentBlock" | "List" | "Identifier" | "WhiteSpace" | "Space" | "Null"; | ||
readonly indent: string; | ||
get(key: string): NullableValue; | ||
} | ||
@@ -79,2 +80,3 @@ export declare class Null extends Node { | ||
toString(): string; | ||
get(key: string): NullableValue; | ||
} | ||
@@ -81,0 +83,0 @@ export declare class StringBlock extends Node { |
@@ -102,2 +102,5 @@ var __extends = (this && this.__extends) || function (d, b) { | ||
}); | ||
Node.prototype.get = function (key) { | ||
return Null.instance; | ||
}; | ||
return Node; | ||
@@ -281,2 +284,5 @@ }()); | ||
}; | ||
KeyValuePair.prototype.get = function (key) { | ||
return this.value ? this.value.get(key) : Null.instance; | ||
}; | ||
return KeyValuePair; | ||
@@ -283,0 +289,0 @@ }(Node)); |
{ | ||
"name": "pbxproj-dom", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "", | ||
"main": "index.js", | ||
"devDependencies": { | ||
"@types/chai": "^3.4.34", | ||
"@types/mocha": "^2.2.33", | ||
@@ -8,0 +9,0 @@ "@types/node": "0.0.2", |
26
test.js
@@ -72,3 +72,29 @@ var ast = require("./parser"); | ||
}); | ||
it("can read signing style of autmatically signed target", function () { | ||
var xcode = xcode_1.Xcode.open("tests/signing-style/automatic.pbxproj"); | ||
var signing = xcode.getSigning("SampleProvProfApp"); | ||
chai_1.assert.deepEqual(signing, { style: "Automatic", team: "W7TGC3P93K" }); | ||
}); | ||
it("can read signing style of manually signed target", function () { | ||
var xcode = xcode_1.Xcode.open("tests/signing-style/manual-with-provisioning.pbxproj"); | ||
var signing = xcode.getSigning("SampleProvProfApp"); | ||
chai_1.assert.deepEqual(signing, { | ||
style: "Manual", | ||
configurations: { | ||
"Debug": { | ||
uuid: 'a62743b2-2513-4488-8d83-bad5f3b6716d', | ||
name: 'NativeScriptDevProfile', | ||
identity: undefined, | ||
team: 'W7TGC3P93K' | ||
}, | ||
"Release": { | ||
uuid: 'a62743b2-2513-4488-8d83-bad5f3b6716d', | ||
name: 'NativeScriptDevProfile', | ||
identity: undefined, | ||
team: 'W7TGC3P93K' | ||
} | ||
} | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=test.js.map |
import * as pbx from "./pbx"; | ||
export interface ManualSigning { | ||
team: string; | ||
uuid: string; | ||
name: string; | ||
identity?: "iPhone Developer" | "iPhone Distribution" | string; | ||
} | ||
export interface AutomaticSigning { | ||
team: string; | ||
} | ||
/** | ||
@@ -25,8 +34,3 @@ * Facade encapsulating common Xcode interractions. | ||
*/ | ||
setManualSigningStyle(targetName: string, {team, uuid, name, identity}?: { | ||
team: string; | ||
uuid: string; | ||
name: string; | ||
identity?: "iPhone Developer" | "iPhone Distribution" | string; | ||
}): void; | ||
setManualSigningStyle(targetName: string, {team, uuid, name, identity}?: ManualSigning): void; | ||
/** | ||
@@ -37,2 +41,14 @@ * Sets Automatic signing style for a target in the pbx.Document. | ||
/** | ||
* Read the signing configuration for a target. | ||
*/ | ||
getSigning(targetName: string): { | ||
style: "Automatic"; | ||
team: string; | ||
} | { | ||
style: "Manual"; | ||
configurations: { | ||
[config: string]: ManualSigning; | ||
}; | ||
} | undefined; | ||
/** | ||
* Serializes the project back to string format. | ||
@@ -39,0 +55,0 @@ */ |
37
xcode.js
@@ -97,2 +97,39 @@ var parser = require("./parser"); | ||
/** | ||
* Read the signing configuration for a target. | ||
*/ | ||
Xcode.prototype.getSigning = function (targetName) { | ||
for (var _i = 0, _a = this.document.projects; _i < _a.length; _i++) { | ||
var project = _a[_i]; | ||
for (var _b = 0, _c = project.targets; _b < _c.length; _b++) { | ||
var target = _c[_b]; | ||
if (target.name === targetName) { | ||
var targetAttributes = project.ast.get("attributes").get("TargetAttributes").get(target.key); | ||
var style = targetAttributes.get("ProvisioningStyle").text; | ||
var team = targetAttributes.get("DevelopmentTeam").text; | ||
if (style === "Automatic") { | ||
return { style: style, team: team }; | ||
} | ||
else if (style === "Manual") { | ||
var configurations = {}; | ||
for (var _d = 0, _e = target.buildConfigurationsList.buildConfigurations; _d < _e.length; _d++) { | ||
var config = _e[_d]; | ||
// {team, uuid, name, identity} | ||
var buildSettings = config.ast.get("buildSettings"); | ||
var uuid = buildSettings.get("PROVISIONING_PROFILE").text; | ||
var name = buildSettings.get("PROVISIONING_PROFILE_SPECIFIER").text; | ||
var identity = buildSettings.get("CODE_SIGN_IDENTITY[sdk=iphoneos*]").text; | ||
var team_1 = buildSettings.get("DEVELOPMENT_TEAM").text; | ||
configurations[config.name] = { uuid: uuid, name: name, identity: identity, team: team_1 }; | ||
} | ||
return { style: style, configurations: configurations }; | ||
} | ||
else { | ||
return undefined; | ||
} | ||
} | ||
} | ||
} | ||
return undefined; | ||
}; | ||
/** | ||
* Serializes the project back to string format. | ||
@@ -99,0 +136,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77350
1908
8
17