Commit f4c411e7 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4765 from efirestone/firestone/variant-groups-fix

Fix bug where lproj directories aren't added to project
parents ddbffba9 3a4d1a83
...@@ -10,6 +10,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -10,6 +10,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Properly add resource files to resources build phase.
[Eric Firestone](https://github.com/efirestone)
[#4762](https://github.com/CocoaPods/CocoaPods/issues/4762)
* Fix suggestion of sudo when it actually isn't needed. * Fix suggestion of sudo when it actually isn't needed.
[Marcel Jackwerth](https://github.com/sirlantis) [Marcel Jackwerth](https://github.com/sirlantis)
......
...@@ -199,29 +199,29 @@ module Pod ...@@ -199,29 +199,29 @@ module Pod
lproj_paths = Set.new lproj_paths = Set.new
lproj_paths_with_files = Set.new lproj_paths_with_files = Set.new
allowable_paths = paths.select do |path| allowable_paths = paths.select do |path|
path_str = path.to_s.downcase path_str = path.to_s
# We add the directory for a Core Data model, but not the items in it. # We add the directory for a Core Data model, but not the items in it.
next if path_str =~ /.*\.xcdatamodeld\/.+/ next if path_str =~ /.*\.xcdatamodeld\/.+/i
# We add the directory for an asset catalog, but not the items in it. # We add the directory for an asset catalog, but not the items in it.
next if path_str =~ /.*\.xcassets\/.+/ next if path_str =~ /.*\.xcassets\/.+/i
if path_str =~ /\.lproj(\/|$)/ if path_str =~ /\.lproj(\/|$)/i
# If the element is an .lproj directory then save it and potentially # If the element is an .lproj directory then save it and potentially
# add it later if we don't find any contained items. # add it later if we don't find any contained items.
if path_str.end_with?('.lproj') && path.directory? if path_str =~ /\.lproj$/i && path.directory?
lproj_paths << path_str lproj_paths << path
next next
end end
# Collect the paths for the .lproj directories that contain files. # Collect the paths for the .lproj directories that contain files.
lproj_path = /(^.*\.lproj)\/.*/.match(path_str)[1] lproj_path = /(^.*\.lproj)\/.*/i.match(path_str)[1]
lproj_paths_with_files << lproj_path lproj_paths_with_files << Pathname(lproj_path)
# Directories nested within an .lproj directory are added as file # Directories nested within an .lproj directory are added as file
# system references so their contained items are not added directly. # system references so their contained items are not added directly.
next if path.dirname.dirname.to_s.downcase == lproj_path next if path.dirname.dirname == lproj_path
end end
true true
......
...@@ -12,7 +12,7 @@ module Pod ...@@ -12,7 +12,7 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe 'Installation' do describe 'Installation With Flat Resources Glob' do
it 'adds the files references of the source files the Pods project' do it 'adds the files references of the source files the Pods project' do
@file_accessor.path_list.read_file_system @file_accessor.path_list.read_file_system
@file_accessor.path_list.expects(:read_file_system) @file_accessor.path_list.expects(:read_file_system)
...@@ -47,20 +47,24 @@ module Pod ...@@ -47,20 +47,24 @@ module Pod
file_ref.path.should == 'Resources/logo-sidebar.png' file_ref.path.should == 'Resources/logo-sidebar.png'
end end
it "add file references for localization directories if glob doesn't include contained files" do it "adds file references for localization directories if glob doesn't include contained files" do
@installer.install! @installer.install!
file_ref = @installer.pods_project['Pods/BananaLib/Resources/en.lproj'] file_ref = @installer.pods_project['Pods/BananaLib/Resources/en.lproj']
file_ref.should.be.not.nil file_ref.should.be.not.nil
file_ref.path.should == 'Resources/en.lproj'
end end
it 'adds file references for files within CoreData directories' do it 'adds file references for files within CoreData directories' do
@installer.install! @installer.install!
model_ref = @installer.pods_project['Pods/BananaLib/Resources/Sample.xcdatamodeld'] model_ref = @installer.pods_project['Pods/BananaLib/Resources/Sample.xcdatamodeld']
model_ref.should.be.not.nil model_ref.should.be.not.nil
model_ref.path.should == 'Resources/Sample.xcdatamodeld'
# Files within the .xcdatamodeld directory are added automatically by adding the .xcdatamodeld directory. # Files within the .xcdatamodeld directory are added automatically by adding the .xcdatamodeld directory.
file_ref = @installer.pods_project['Pods/BananaLib/Resources/Sample.xcdatamodeld/Sample.xcdatamodel'] file_ref = @installer.pods_project['Pods/BananaLib/Resources/Sample.xcdatamodeld/Sample.xcdatamodel']
file_ref.should.be.not.nil file_ref.should.be.not.nil
file_ref.path.should == 'Sample.xcdatamodel'
file_ref.source_tree.should == '<group>'
end end
it 'links the headers required for building the pod target' do it 'links the headers required for building the pod target' do
......
...@@ -124,6 +124,9 @@ module Pod ...@@ -124,6 +124,9 @@ module Pod
resources.count.should > 0 resources.count.should > 0
resource = resources.find { |res| res.file_ref.path.include?('logo-sidebar.png') } resource = resources.find { |res| res.file_ref.path.include?('logo-sidebar.png') }
resource.should.be.not.nil resource.should.be.not.nil
resource = resources.find { |res| res.file_ref.path.include?('en.lproj') }
resource.should.be.not.nil
end end
#--------------------------------------# #--------------------------------------#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment