Can't figure out how to correctly add xcdatamodeld to project.
project = Xcodeproj::Project.new
resources = project.groups.new('path' => resources_path, 'name' => 'Resources')
resources.files.new('path' => path_to_xcdatamodeld)
if I open ui.xcodeproj then I can't open added xcdatamodeld %( Any hint to get it working?
I think the best way to debug this is by creating an Xcode project manually and then compare that with the result of your code snippet.
xcdatamodel should be wrapped with XCVersionGroup https://github.com/yury/ib/blob/ee1bbf7d63076fbcf24b0e734ef85f89e90658bb/lib/ib/project.rb#L18
I would love a patch for this :) Is that something you were planning to do?
Would like create patch but I'm afraid that I don't understand xcode structure and this project completely.
Should it be custom group class?
What interface you would like to see?
If I understood your example correctly, it is a specialized version of a PBXGroup, right? So I think you really only need to add a XCVersionGroup subclass of PBXGroup, which can be done in the existing group source file and a little doc that explains what this type of group is used for.
A version_groups method on PBXGroup might be handy. It would cleanup your code to:
resources.version_groups.new('path' => file, 'versionGroupType' => 'wrapper.xcdatamodel')
And since there apparently can be multiple wrapper types, a factory class method like this:
class XCVersionGroup < PBXGroup
def self.new_xcmodeldata_group(project, xcmodeldata_path)
group = new(project, nil, 'versionGroupType' => 'wrapper.xcdatamodel')
file = group.files.new('path' => file.gsub(/xcdatamodeld$/, 'xcdatamodel'), 'sourceTree' => '<group>', 'lastKnownFileType' => 'wrapper.xcdatamodel')
group.currentVersion = file.uuid
Which would reduce your code to:
thanks, will try to provide patch later today
Sweet, thanks :)
Add XCVersionGroup support for xcdatamodeld files. Closes #21