Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
f2d63c52
Unverified
Commit
f2d63c52
authored
Mar 22, 2018
by
Dimitris Koutsogiorgas
Committed by
GitHub
Mar 22, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7539 from CocoaPods/manu-fix-preserve-glob-order
Return list of files preserving given pattern order on glob
parents
0778a2aa
99a2f74f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
path_list.rb
lib/cocoapods/sandbox/path_list.rb
+11
-9
path_list_spec.rb
spec/unit/sandbox/path_list_spec.rb
+15
-0
No files found.
lib/cocoapods/sandbox/path_list.rb
View file @
f2d63c52
...
...
@@ -129,24 +129,26 @@ module Pod
full_list
=
files
end
patterns_array
=
Array
(
patterns
)
exact_matches
=
full_list
&
patterns_array
patterns_array
-=
exact_matches
exact_matches
=
(
full_list
&
patterns_array
).
to_set
all_patterns
=
patterns_array
.
map
do
|
pattern
|
unless
patterns_array
.
empty?
list
=
patterns_array
.
flat_map
do
|
pattern
|
if
exact_matches
.
include?
(
pattern
)
pattern
else
if
directory?
(
pattern
)
&&
dir_pattern
pattern
+=
'/'
unless
pattern
.
end_with?
(
'/'
)
pattern
+=
dir_pattern
end
dir_glob_equivalent_patterns
(
pattern
)
end
.
flatten
list
=
exact_matches
unless
all_patterns
.
empty?
list
+=
full_list
.
select
do
|
path
|
all_patterns
.
any?
do
|
p
|
expanded_patterns
=
dir_glob_equivalent_patterns
(
pattern
)
full_list
.
select
do
|
path
|
expanded_patterns
.
any?
do
|
p
|
File
.
fnmatch
(
p
,
path
,
File
::
FNM_CASEFOLD
|
File
::
FNM_PATHNAME
)
end
end
end
end
end
list
=
list
.
map
{
|
path
|
Pathname
.
new
(
path
)
}
if
exclude_patterns
...
...
spec/unit/sandbox/path_list_spec.rb
View file @
f2d63c52
...
...
@@ -199,6 +199,21 @@ module Pod
libBananalib.a
)
end
it
'preserves pattern order'
do
patterns
=
%w(
Classes/BananaPrivate.h
Classes/Banana.h
Classes/Banana.m
)
paths
=
@path_list
.
relative_glob
(
patterns
).
map
(
&
:to_s
)
paths
.
should
==
%w(
Classes/BananaPrivate.h
Classes/Banana.h
Classes/Banana.m
)
end
end
describe
'Reading file system'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment