Skip to content

Commit

Permalink
Merge pull request #427 from cobi-bike/master
Browse files Browse the repository at this point in the history
#221 Fixed handling of xcdatamodeld packages in subfolders
  • Loading branch information
endocrimes authored Oct 15, 2016
2 parents d21b7d0 + 5447d7a commit ca68a6b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
[Danielle Tomlinson](https://github.com/dantoml)
[#421](https://github.com/CocoaPods/Xcodeproj/pull/421)

* Fixed handling of xcdatamodeld packages in subfolders.
[Simon Seyer](https://github.com/Eldorado234)
[#427](https://github.com/CocoaPods/Xcodeproj/pull/427)

## 1.3.1 (2016-09-10)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ def new_xcdatamodeld(group, path, source_tree)
GroupableHelper.set_path_with_source_tree(ref, path, source_tree)
ref.version_group_type = 'wrapper.xcdatamodel'

real_path = group.real_path.join(path)
current_version_name = nil
if path.exist?
path.children.each do |child_path|
if real_path.exist?
real_path.children.each do |child_path|
if File.extname(child_path) == '.xcdatamodel'
new_file_reference(ref, child_path, :group)
elsif File.basename(child_path) == '.xccurrentversion'
full_path = path + File.basename(child_path)
full_path = real_path + File.basename(child_path)
xccurrentversion = Plist.read_from_path(full_path)
current_version_name = xccurrentversion['_XCCurrentVersionName']
end
Expand Down
14 changes: 14 additions & 0 deletions spec/project/object/helpers/file_references_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,20 @@ module ProjectSpecs
ref.current_version.source_tree.should == '<group>'
@group.children.should.include(ref)
end

it 'resolves path to models in subfolders' do
group_path = fixture_path('CoreData')
group = @group.new_group('CoreData', group_path)

path = 'VersionedModel.xcdatamodeld'
ref = @factory.send(:new_xcdatamodeld, group, path, :group)

ref.current_version.isa.should == 'PBXFileReference'
ref.current_version.path.should.include 'VersionedModel 2.xcdatamodel'
ref.current_version.last_known_file_type.should == 'wrapper.xcdatamodel'
ref.current_version.source_tree.should == '<group>'
group.children.should.include(ref)
end
end

#-------------------------------------------------------------------------#
Expand Down

0 comments on commit ca68a6b

Please sign in to comment.