Fixed bug where comment is not removed on removing embedded frameworks. (#5)
diff --git a/lib/pbxProject.js b/lib/pbxProject.js
index c14f28b..0c05d09 100644
--- a/lib/pbxProject.js
+++ b/lib/pbxProject.js
@@ -484,10 +484,11 @@
if (this.pbxBuildFileSection()[uuid].fileRef_comment == file.basename) {
file.uuid = uuid;
delete this.pbxBuildFileSection()[uuid];
+
+ var commentKey = f("%s_comment", uuid);
+ delete this.pbxBuildFileSection()[commentKey];
}
}
- var commentKey = f("%s_comment", file.uuid);
- delete this.pbxBuildFileSection()[commentKey];
}
pbxProject.prototype.addPbxGroup = function(filePathsArray, name, path, sourceTree) {
diff --git a/test/removeFramework.js b/test/removeFramework.js
index 248a1e7..20cdbde 100644
--- a/test/removeFramework.js
+++ b/test/removeFramework.js
@@ -166,5 +166,32 @@
}
test.done();
+ },
+ 'should remove embedded frameworks': function (test) {
+ var newFile = proj.addFramework('/path/to/Custom.framework', { customFramework: true, embed:true, sign:true }),
+ frameworks = proj.pbxFrameworksBuildPhaseObj(),
+ buildFileSection = proj.pbxBuildFileSection(),
+ bfsLength = Object.keys(buildFileSection).length;
+
+ test.equal(frameworks.files.length, 16);
+ test.equal(62, bfsLength);
+
+ var deletedFile = proj.removeFramework('/path/to/Custom.framework', { customFramework: true, embed:true }),
+ frameworks = proj.pbxFrameworksBuildPhaseObj(),
+ buildFileSection = proj.pbxBuildFileSection(),
+ bfsLength = Object.keys(buildFileSection).length;
+
+ test.equal(frameworks.files.length, 15);
+ test.equal(58, bfsLength);
+
+ var frameworkPaths = frameworkSearchPaths(proj);
+ expectedPath = '"/path/to"';
+
+ for (i = 0; i < frameworkPaths.length; i++) {
+ var current = frameworkPaths[i];
+ test.ok(current.indexOf(expectedPath) == -1);
+ }
+
+ test.done();
}
}