Commit cfd10bfb authored by Fabio Pelosin's avatar Fabio Pelosin

[PathList] Fix support for patterns ending with a slash.

See #859
parent 3ca4216d
...@@ -95,7 +95,10 @@ module Pod ...@@ -95,7 +95,10 @@ module Pod
list = Array(patterns).map do |pattern| list = Array(patterns).map do |pattern|
if pattern.is_a?(String) if pattern.is_a?(String)
pattern += '/' + dir_pattern if directory?(pattern) && dir_pattern if directory?(pattern) && dir_pattern
pattern += '/' unless pattern.end_with?('/')
pattern += dir_pattern
end
expanded_patterns = dir_glob_equivalent_patterns(pattern) expanded_patterns = dir_glob_equivalent_patterns(pattern)
full_list.select do |path| full_list.select do |path|
expanded_patterns.any? do |p| expanded_patterns.any? do |p|
......
...@@ -80,6 +80,15 @@ module Pod ...@@ -80,6 +80,15 @@ module Pod
] ]
end end
it "handles directories specified with a trailing slash" do
paths = @path_list.relative_glob('Classes/', { :dir_pattern => '*.{h,m}'} ).map(&:to_s)
paths.sort.should == %w[
Classes/Banana.h
Classes/Banana.m
Classes/BananaPrivate.h
]
end
it "supports an optional list of patterns to exclude" do it "supports an optional list of patterns to exclude" do
exclude_patterns = ['**/*.m', '**/*Private*.*'] exclude_patterns = ['**/*.m', '**/*Private*.*']
paths = @path_list.relative_glob('Classes/*', { :exclude_patterns => exclude_patterns }).map(&:to_s) paths = @path_list.relative_glob('Classes/*', { :exclude_patterns => exclude_patterns }).map(&:to_s)
......
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