You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2017/04/11 21:04:53 UTC

[31/50] [abbrv] cordova-node-xcode git commit: pbxProject removeTargetAttribute

pbxProject removeTargetAttribute


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/fb628c61
Tree: http://git-wip-us.apache.org/repos/asf/cordova-node-xcode/tree/fb628c61
Diff: http://git-wip-us.apache.org/repos/asf/cordova-node-xcode/diff/fb628c61

Branch: refs/heads/master
Commit: fb628c61f92a8363b471fbfc5eb708d009071085
Parents: c78d781
Author: Sergey <se...@MacBook-Pro-Sergey.local>
Authored: Sat Dec 10 16:48:52 2016 +0300
Committer: Sergey <se...@MacBook-Pro-Sergey.local>
Committed: Sat Dec 10 16:48:52 2016 +0300

----------------------------------------------------------------------
 lib/pbxProject.js |  9 +++++++++
 test/group.js     | 27 ++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-node-xcode/blob/fb628c61/lib/pbxProject.js
----------------------------------------------------------------------
diff --git a/lib/pbxProject.js b/lib/pbxProject.js
index 69948da..13e7246 100644
--- a/lib/pbxProject.js
+++ b/lib/pbxProject.js
@@ -1918,4 +1918,13 @@ pbxProject.prototype.addTargetAttribute = function(prop, value, target) {
     attributes['TargetAttributes'][target.uuid][prop] = value;
 }
 
+pbxProject.prototype.removeTargetAttribute = function(prop, target) {
+    var attributes = this.getFirstProject()['firstProject']['attributes'];
+    target = target || this.getFirstTarget();
+    if (attributes['TargetAttributes'] &&
+        attributes['TargetAttributes'][target.uuid]) {
+        delete attributes['TargetAttributes'][target.uuid][prop];
+    }
+}
+
 module.exports = pbxProject;

http://git-wip-us.apache.org/repos/asf/cordova-node-xcode/blob/fb628c61/test/group.js
----------------------------------------------------------------------
diff --git a/test/group.js b/test/group.js
index 543f0f1..b907c7e 100644
--- a/test/group.js
+++ b/test/group.js
@@ -346,13 +346,34 @@ exports.testWritingPBXProject = {
 
         test.done();
     },
-    'should successfully add target attribute to PBXProject TargetAttributes': function(test) {
-        console.log(project.addTargetAttribute);
+    'should add target attribute to PBXProject TargetAttributes': function(test) {
         project.addTargetAttribute('ProvisioningStyle', 'Manual');
+        var output = project.writeSync();
+        test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g).length, 1);
+
+        test.done();
+    },
+    'should change target attribute at PBXProject TargetAttributes': function(test) {
+        project.addTargetAttribute('ProvisioningStyle', 'Manual');
+        var output = project.writeSync();
+        test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g).length, 1);
+
+        project.addTargetAttribute('ProvisioningStyle', 'Automatic');
+        output = project.writeSync();
+        test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g), null);
+        test.equal(output.match(/ProvisioningStyle\s*=\s*Automatic/g).length, 1);
 
+        test.done();
+    },
+    'should remove target attribute from PBXProject TargetAttributes': function(test) {
+        project.addTargetAttribute('ProvisioningStyle', 'Manual');
         var output = project.writeSync();
-        console.log(output);
         test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g).length, 1);
+
+        project.removeTargetAttribute('ProvisioningStyle');
+        output = project.writeSync();
+        test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g), null);
+
         test.done();
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org