Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C6BD8200C62 for ; Tue, 11 Apr 2017 23:04:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C5AC4160B7D; Tue, 11 Apr 2017 21:04:28 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BD5C6160BB0 for ; Tue, 11 Apr 2017 23:04:26 +0200 (CEST) Received: (qmail 51330 invoked by uid 500); 11 Apr 2017 21:04:25 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 50336 invoked by uid 99); 11 Apr 2017 21:04:24 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Apr 2017 21:04:24 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6008CE028C; Tue, 11 Apr 2017 21:04:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: purplecabbage@apache.org To: commits@cordova.apache.org Date: Tue, 11 Apr 2017 21:04:52 -0000 Message-Id: <12025c226e654760b1c73d2c594da782@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [30/50] [abbrv] cordova-node-xcode git commit: pbxProject addTargetAttribute archived-at: Tue, 11 Apr 2017 21:04:28 -0000 pbxProject addTargetAttribute Project: http://git-wip-us.apache.org/repos/asf/cordova-node-xcode/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-node-xcode/commit/c78d781e Tree: http://git-wip-us.apache.org/repos/asf/cordova-node-xcode/tree/c78d781e Diff: http://git-wip-us.apache.org/repos/asf/cordova-node-xcode/diff/c78d781e Branch: refs/heads/master Commit: c78d781e59d88767b72799d8c27b2f321bff72ee Parents: 4cca2f6 Author: Sergey Authored: Fri Dec 9 15:24:35 2016 +0300 Committer: Sergey Committed: Fri Dec 9 15:24:35 2016 +0300 ---------------------------------------------------------------------- lib/pbxProject.js | 23 +++++++++++++++++------ test/group.js | 12 ++++++++++-- 2 files changed, 27 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-node-xcode/blob/c78d781e/lib/pbxProject.js ---------------------------------------------------------------------- diff --git a/lib/pbxProject.js b/lib/pbxProject.js index c568e50..69948da 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -230,7 +230,7 @@ pbxProject.prototype.addResourceFile = function(path, opt, group) { file = this.addPluginFile(path, opt); if (!file) return false; } else { - file = new pbxFile(path, opt); + file = new pbxFile(path, opt); if (this.hasFile(file.path)) return false; } @@ -241,10 +241,10 @@ pbxProject.prototype.addResourceFile = function(path, opt, group) { correctForResourcesPath(file, this); file.fileRef = this.generateUuid(); } - + this.addToPbxBuildFileSection(file); // PBXBuildFile this.addToPbxResourcesBuildPhase(file); // PBXResourcesBuildPhase - + if (!opt.plugin) { this.addToPbxFileReferenceSection(file); // PBXFileReference if (group) { @@ -253,9 +253,9 @@ pbxProject.prototype.addResourceFile = function(path, opt, group) { else { this.addToResourcesPbxGroup(file); // PBXGroup } - + } - + return file; } @@ -279,7 +279,7 @@ pbxProject.prototype.removeResourceFile = function(path, opt, group) { } else { this.removeFromResourcesPbxGroup(file); // PBXGroup - } + } this.removeFromPbxResourcesBuildPhase(file); // PBXResourcesBuildPhase return file; @@ -1906,5 +1906,16 @@ pbxProject.prototype.addDataModelDocument = function(filePath, group, opt) { return file; } +pbxProject.prototype.addTargetAttribute = function(prop, value, target) { + var attributes = this.getFirstProject()['firstProject']['attributes']; + if (attributes['TargetAttributes'] === undefined) { + attributes['TargetAttributes'] = {}; + } + target = target || this.getFirstTarget(); + if (attributes['TargetAttributes'][target.uuid] === undefined) { + attributes['TargetAttributes'][target.uuid] = {}; + } + attributes['TargetAttributes'][target.uuid][prop] = value; +} module.exports = pbxProject; http://git-wip-us.apache.org/repos/asf/cordova-node-xcode/blob/c78d781e/test/group.js ---------------------------------------------------------------------- diff --git a/test/group.js b/test/group.js index 8eb5b00..543f0f1 100644 --- a/test/group.js +++ b/test/group.js @@ -215,7 +215,7 @@ exports.removeHeaderFileFromGroup = { exports.addResourceFileToGroup = { 'should add resource file (PNG) to the splash group' : function(test) { - + var testKey = project.findPBXGroupKey({path:'splash'}); var file = project.addResourceFile('DefaultTest-667h.png', {}, testKey); @@ -311,7 +311,6 @@ exports.validateHasFile = { } exports.testWritingPBXProject = { - 'should successfully write to PBXProject TargetAttributes': function(test) { var pbxProjectObj = project.getPBXObject('PBXProject'); var pbxProject; @@ -346,5 +345,14 @@ exports.testWritingPBXProject = { var output = project.writeSync(); test.done(); + }, + 'should successfully add target attribute to PBXProject TargetAttributes': function(test) { + console.log(project.addTargetAttribute); + project.addTargetAttribute('ProvisioningStyle', 'Manual'); + + var output = project.writeSync(); + console.log(output); + test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g).length, 1); + test.done(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org