Commit 8e72cbe1 authored by Fabio Pelosin's avatar Fabio Pelosin

[LocalPod] Fixed clean paths.

Closes #519
Closes #568
parent 4b349723
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.15.0...master) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.15.0...master)
###### Bug fixes ###### Bug fixes
- Fixed an issue that lead to empty directories for Pods.
[#519](https://github.com/CocoaPods/CocoaPods/issues/519)
[#568](https://github.com/CocoaPods/CocoaPods/issues/568)
- Fixed a crash related to the RubyGems version informative. - Fixed a crash related to the RubyGems version informative.
[#570](https://github.com/CocoaPods/CocoaPods/issues/570) [#570](https://github.com/CocoaPods/CocoaPods/issues/570)
......
...@@ -163,12 +163,14 @@ module Pod ...@@ -163,12 +163,14 @@ module Pod
# #
# @return [Array<Strings>] The paths that can be deleted. # @return [Array<Strings>] The paths that can be deleted.
# #
# @note The Paths are downcased to prevent issues. See #568.
#
def clean_paths def clean_paths
cached_used_paths = used_files used = used_files.map(&:downcase)
files = Dir.glob(root + "**/*", File::FNM_DOTMATCH) files = Dir.glob(root + "**/*", File::FNM_DOTMATCH).map(&:downcase)
files.reject! do |candidate| files.reject! do |candidate|
candidate.end_with?('.', '..') || cached_used_paths.any? do |path| candidate.end_with?('.', '..') || used.any? do |path|
path.include?(candidate) || candidate.include?(path) path.include?(candidate) || candidate.include?(path)
end end
end end
......
...@@ -56,11 +56,11 @@ describe Pod::LocalPod do ...@@ -56,11 +56,11 @@ describe Pod::LocalPod do
end end
it "returns an expanded list the files to clean" do it "returns an expanded list the files to clean" do
clean_paths = @pod.clean_paths.map { |p| p.to_s.gsub(/.*Pods\/BananaLib/,'') } clean_paths = @pod.clean_paths.map { |p| p.to_s.gsub(/.*pods\/bananalib/,'') }
clean_paths.should.include "/.git/config" clean_paths.should.include "/.git/config"
# * There are some hidden files on Travis # * There are some hidden files on Travis
# * The submodule of the repo (libPusher) can be ignore, to reduce noise of this test # * The submodule of the repo (libPusher) can be ignore, to reduce noise of this test
clean_files_without_hidden = clean_paths.reject { |p| p.to_s.include?('/.') || p.to_s.include?('libPusher') } clean_files_without_hidden = clean_paths.reject { |p| p.to_s.include?('/.') || p.to_s.include?('libpusher') }
clean_files_without_hidden.should == %W[ /sub-dir /sub-dir/sub-dir-2 /sub-dir/sub-dir-2/somefile.txt ] clean_files_without_hidden.should == %W[ /sub-dir /sub-dir/sub-dir-2 /sub-dir/sub-dir-2/somefile.txt ]
end end
...@@ -208,8 +208,9 @@ describe Pod::LocalPod do ...@@ -208,8 +208,9 @@ describe Pod::LocalPod do
/StoreKit/StoreKit_Prefix.pch /StoreKit/StoreKit_Prefix.pch
/UIKit/UIKit_Prefix.pch /UIKit/UIKit_Prefix.pch
] ]
computed = @pod.clean_paths.each{ |p| p.gsub!(@pod.root.to_s, '') } root = @pod.root.to_s.downcase
assert_array_equals(expected, computed) computed = @pod.clean_paths.each{ |p| p.gsub!(root, '') }
assert_array_equals(expected.map(&:downcase), computed)
end end
it "resolves the used files" do it "resolves the used files" do
......
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