-
-
Notifications
You must be signed in to change notification settings - Fork 3
feature: Add groups created by addPbxGroup() to the meta PBXGroup #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1,11 +1,12 @@ | |||
var util = require('util'), | |||
f = util.format, | |||
EventEmitter = require('events').EventEmitter, | |||
path = require('path'), | |||
$path = require('path'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering why we are using $
before path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to differentiate between the global (used for path module) and local (passed in most of the methods) variable.
lib/pbxProject.js
Outdated
var groups = this.hash.project.objects['PBXGroup'], | ||
pbxGroupUuid = this.generateUuid(), | ||
pbxGroupUuid = opt.uuid ? opt.uuid : this.generateUuid(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opt.uuid || this.generateUuid()
is shorter
lib/pbxProject.js
Outdated
var groups = this.hash.project.objects['PBXGroup']; | ||
var candidates = []; | ||
for (var key in groups) { | ||
if (groups[key].path == undefined && groups[key].name == undefined && groups[key].isa) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is better
if (groups[key] && !groups[key].path && !groups[key].name && groups[key].isa) { .. }
return candidates[0]; | ||
} | ||
|
||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case when we have more than one candidate, shouldn't return the first one? Actually is it possible to have more than one candidate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have exactly one candidate as this will be the root group. If they are more than one there should be an error. Maybe we can throw an exception.
d86b18b
to
23214db
Compare
a929177
to
733e10a
Compare
*support for c++ files added *recursively add pbxGroup and its children *recursively remove pbxGroup and its children *make sure pbx group name is not duplicated on adding new group
cc0ac78
to
f1b6a8c
Compare
lib/pbxFile.js
Outdated
@@ -11,13 +15,42 @@ var path = require('path'), | |||
DEFAULT_SOURCE_TREE = '"<group>"', | |||
DEFAULT_FILE_ENCODING = 4; | |||
|
|||
function fileTypes() { | |||
return { | |||
SOURCE_FILE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identation issue
lib/pbxProject.js
Outdated
return {uuid: pbxGroupUuid, pbxGroup: pbxGroup}; | ||
} | ||
|
||
pbxProject.prototype.removePbxGroup = function(name, path) { | ||
var group = this.pbxGroupByName(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identation problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After addressing identation problem
fd2171a
to
93cb011
Compare
Current implementation doesn't add created groups to the main/meta PBXGroup and therefore they don't show up in the file tree.