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
85c65849
Commit
85c65849
authored
May 25, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[LocalPod] Fix bug where in #clean.
The bug would leave trailing directories like '.git'
parent
66138897
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
local_pod.rb
lib/cocoapods/local_pod.rb
+15
-12
No files found.
lib/cocoapods/local_pod.rb
View file @
85c65849
...
@@ -64,17 +64,19 @@ module Pod
...
@@ -64,17 +64,19 @@ module Pod
root
.
rmtree
if
exists?
root
.
rmtree
if
exists?
end
end
# It deletes all the files identified by clean_
path
s, then it removes
# It deletes all the files identified by clean_
file
s, then it removes
# all the empty folders or symlinks.
# all the empty folders or symlinks.
def
clean
def
clean
clean_paths
.
each
{
|
path
|
FileUtils
.
rm_rf
(
path
)
}
clean_files
.
each
{
|
path
|
FileUtils
.
rm_rf
(
path
)
}
Dir
.
glob
(
"
#{
root
}
/**/{*,.*}"
).
sort_by
(
&
:length
).
reverse
.
# Clean the deepest paths first to determine if the containing folders are empty
# Get all the directories. Then sort them from the longest
reject
{
|
d
|
d
=~
/\/\.\.?$/
}
.
# Remove the `.` and `..` paths
# to the shortest, so a directory will be empty if its
select
{
|
d
|
File
.
directory?
(
d
)
}
.
# Get only directories or symlinks to directories
# subdirs where empty. We need to delete the symlinks because
each
do
|
d
|
# it might prevent a bundle from being deleted
FileUtils
.
rm_rf
(
d
)
if
File
.
symlink?
(
d
)
||
(
Dir
.
entries
(
d
)
==
%w[ . .. ]
)
# Remove the symlink and the empty dirs
dirs
=
Dir
.
glob
(
root
+
"**/*"
,
File
::
FNM_DOTMATCH
)
end
dirs
=
dirs
.
reject
{
|
d
|
d
.
end_with?
(
'.'
,
'..'
)
||
!
File
.
directory?
(
d
)
}.
sort_by
(
&
:length
).
reverse
dirs
.
each
{
|
d
|
puts
d
}
dirs
.
each
{
|
d
|
FileUtils
.
rm_rf
(
d
)
if
File
.
symlink?
(
d
)
||
(
Dir
.
entries
(
d
)
==
%w[ . .. ]
)
}
end
end
# File attributes
# File attributes
...
@@ -95,12 +97,13 @@ module Pod
...
@@ -95,12 +97,13 @@ module Pod
chained_expanded_paths
(
:resources
,
:relative_to_sandbox
=>
relative
)
chained_expanded_paths
(
:resources
,
:relative_to_sandbox
=>
relative
)
end
end
def
clean_paths
def
clean_files
expanded_paths
(
'**/{*,.*}'
).
reject
{
|
p
|
p
.
directory?
}
-
used_files
all_files
=
Dir
.
glob
(
root
+
"**/*"
,
File
::
FNM_DOTMATCH
).
map
{
|
f
|
root
+
f
}.
reject
{
|
p
|
p
.
directory?
}
all_files
-
used_files
end
end
def
used_files
def
used_files
source_files
(
false
)
+
resources
(
false
)
+
[
readme_file
,
license_file
,
prefix_header_file
]
+
preserve_paths
source_files
(
false
)
+
resources
(
false
)
+
preserve_paths
+
[
readme_file
,
license_file
,
prefix_header_file
]
end
end
# TODO: implement case insensitive search
# TODO: implement case insensitive search
...
...
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