Commit 21e60f91 authored by Fabio Pelosin's avatar Fabio Pelosin

[PathList] Fix for Ruby 2.0.0-preview2.

parent 71983133
......@@ -42,17 +42,15 @@ module Pod
# @return [void] Reads the file system and populates the files and paths
# lists.
#
# @todo Ruby 2.0 developer preview 1 does not returns directories
# ending with '/.' and '/..'.
#
def read_file_system
root_length = root.to_s.length+1
paths = Dir.glob(root + "**/*", File::FNM_DOTMATCH)
paths = paths.map { |p| p[root_length..-1] }
paths = paths.reject { |p| p == '.' || p == '..' }
dirs_entries = paths.select { |path| path.end_with?('/.', '/..') }
@files = paths - dirs_entries
@dirs = dirs_entries.map { |d| d.gsub(/\/\.\.?$/,'') }.uniq
root_length = root.to_s.length+1
paths = Dir.glob(root + "**/*", File::FNM_DOTMATCH)
dirs = paths.select { |path| File.directory?(path) }
dirs = dirs.map { |p| p[root_length..-1] }
paths = paths.map { |p| p[root_length..-1] }
paths = paths.reject { |p| p == '.' || p == '..' }
@files = paths - dirs
@dirs = dirs.map { |d| d.gsub(/\/\.\.?$/,'') }.uniq
end
# @return [Array<Pathname>] Similar to {glob} but returns the absolute
......
......@@ -11,12 +11,17 @@ describe Pod::LocalPod::PathList do
files.reject! do |f|
f.include?('libPusher') || f.include?('.git') || f.include?('DS_Store')
end
files.sort.should == %w|
expected = %w[
BananaLib.podspec
Classes Classes/Banana.h Classes/Banana.m Classes/BananaLib.pch
Classes/Banana.h
Classes/Banana.m
Classes/BananaLib.pch
README
Resources Resources/logo-sidebar.png
sub-dir sub-dir/sub-dir-2 sub-dir/sub-dir-2/somefile.txt |
Resources/logo-sidebar.png
sub-dir/sub-dir-2/somefile.txt
]
files.sort.should == expected
end
it "creates theh list of the directories" 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