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
d35acaba
Commit
d35acaba
authored
May 15, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[LocalPod] Cleaning fixes and code clean up.
parent
6bbbdbac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
local_pod.rb
lib/cocoapods/local_pod.rb
+10
-16
No files found.
lib/cocoapods/local_pod.rb
View file @
d35acaba
module
Pod
module
Pod
class
LocalPod
class
LocalPod
attr_reader
:top_specification
,
:specifications
attr_reader
:top_specification
,
:specifications
# TODO: fix accross the app
attr_reader
:sandbox
attr_reader
:sandbox
def
initialize
(
specification
,
sandbox
,
platform
)
def
initialize
(
specification
,
sandbox
,
platform
)
...
@@ -65,11 +64,11 @@ module Pod
...
@@ -65,11 +64,11 @@ module Pod
# remove empty diretories
# remove empty diretories
Dir
.
glob
(
"
#{
root
}
/**/{*,.*}"
).
Dir
.
glob
(
"
#{
root
}
/**/{*,.*}"
).
sort_by
(
&
:length
).
reverse
.
# Clean the deepest paths first to determine if the containing folders are empty
sort_by
(
&
:length
).
reverse
.
# Clean the deepest paths first to determine if the containing folders are empty
reject
{
|
d
|
d
=~
/\/\.\.?$/
}
.
# Remove the `.` and `..` paths
reject
{
|
d
|
d
=~
/\/\.\.?$/
}
.
# Remove the `.` and `..` paths
select
{
|
d
|
File
.
directory?
(
d
)
}
.
# Get only directories or symlinks to directories
select
{
|
d
|
File
.
directory?
(
d
)
}
.
# Get only directories or symlinks to directories
each
do
|
d
|
each
do
|
d
|
FileUtils
.
rm_rf
(
d
)
if
File
.
symlink?
(
d
)
||
(
Dir
.
entries
(
d
)
==
%w[ . .. ]
)
# Remove the
dirs/symlink only if it is empty
FileUtils
.
rm_rf
(
d
)
if
File
.
symlink?
(
d
)
||
(
Dir
.
entries
(
d
)
==
%w[ . .. ]
)
# Remove the
symlink and the empty dirs
end
end
end
end
...
@@ -88,26 +87,23 @@ module Pod
...
@@ -88,26 +87,23 @@ module Pod
end
end
def
clean_paths
def
clean_paths
paths
=
expanded_paths
(
'**/*'
).
reject
{
|
p
|
p
.
directory?
}
expanded_paths
(
'**/{*,.*}'
).
reject
{
|
p
|
p
.
directory?
}
-
used_files
# TODO: deprecate Specification#clean_paths
paths
=
@top_specification
.
clean_paths
unless
@top_specification
.
clean_paths
.
empty?
paths
-
used_files
end
end
def
used_files
def
used_files
source_files
(
false
)
+
resources
(
false
)
+
[
readme_file
,
license_file
,
prefix_header_file
]
+
expanded_paths
(
'*.podspec'
)
+
preserve_paths
source_files
(
false
)
+
resources
(
false
)
+
[
readme_file
,
license_file
,
prefix_header_file
]
+
preserve_paths
end
end
def
readme_file
def
readme_file
expanded_paths
(
'README.*'
).
first
expanded_paths
(
%w[README* readme*]
).
first
end
end
def
license_file
def
license_file
expanded_paths
(
%w[ LICENSE
licence.txt
]
).
first
expanded_paths
(
%w[ LICENSE
* licence*
]
).
first
end
end
def
preserve_paths
def
preserve_paths
chained_expanded_paths
(
:preserve_paths
)
chained_expanded_paths
(
:preserve_paths
)
+
expanded_paths
(
%w[ *.podspec notice* NOTICE* ]
)
end
end
def
header_files
def
header_files
...
@@ -127,13 +123,11 @@ module Pod
...
@@ -127,13 +123,11 @@ module Pod
#TODO: fix
#TODO: fix
def
add_to_target
(
target
)
def
add_to_target
(
target
)
implementation_files
.
each
do
|
file
|
implementation_files
.
each
do
|
file
|
# TODO: respect the compiler flags of each subspec
target
.
add_source_file
(
file
,
nil
,
top_specification
.
compiler_flags
.
strip
)
target
.
add_source_file
(
file
,
nil
,
top_specification
.
compiler_flags
.
strip
)
end
end
end
end
def
compiler_flags
end
def
requires_arc?
def
requires_arc?
top_specification
.
requires_arc
top_specification
.
requires_arc
...
...
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