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
befcc909
Commit
befcc909
authored
Aug 19, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Installer] Fix source locking/unlocking
parent
4c2395b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
16 deletions
+54
-16
installer.rb
lib/cocoapods/installer.rb
+30
-11
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+24
-5
No files found.
lib/cocoapods/installer.rb
View file @
befcc909
...
...
@@ -115,7 +115,6 @@ module Pod
def
prepare
UI
.
message
'Preparing'
do
FileUtils
.
chmod_R
(
'+w'
,
sandbox
.
root
)
sandbox
.
prepare
ensure_plugins_are_installed!
Migrator
.
migrate
(
sandbox
)
...
...
@@ -307,18 +306,14 @@ module Pod
install_source_of_pod
(
spec
.
name
)
end
else
UI
.
titled_section
(
"Using
#{
spec
}
"
,
title_options
)
UI
.
titled_section
(
"Using
#{
spec
}
"
,
title_options
)
do
create_pod_installer
(
spec
.
name
)
end
end
end
end
# Install the Pods. If the resolver indicated that a Pod should be
# installed and it exits, it is removed an then reinstalled. In any case if
# the Pod doesn't exits it is installed.
#
# @return [void]
#
def
install_source_of_pod
(
pod_name
)
def
create_pod_installer
(
pod_name
)
specs_by_platform
=
{}
pod_targets
.
each
do
|
pod_target
|
if
pod_target
.
root_spec
.
name
==
pod_name
...
...
@@ -329,9 +324,20 @@ module Pod
@pod_installers
||=
[]
pod_installer
=
PodSourceInstaller
.
new
(
sandbox
,
specs_by_platform
)
pod_installer
.
install!
@pod_installers
<<
pod_installer
@installed_specs
.
concat
(
specs_by_platform
.
values
.
flatten
.
uniq
)
pod_installer
end
# Install the Pods. If the resolver indicated that a Pod should be
# installed and it exits, it is removed an then reinstalled. In any case if
# the Pod doesn't exits it is installed.
#
# @return [void]
#
def
install_source_of_pod
(
pod_name
)
pod_installer
=
create_pod_installer
(
pod_name
)
pod_installer
.
install!
@installed_specs
.
concat
(
pod_installer
.
specs_by_platform
.
values
.
flatten
.
uniq
)
end
# Cleans the sources of the Pods if the config instructs to do so.
...
...
@@ -344,6 +350,18 @@ module Pod
@pod_installers
.
each
(
&
:clean!
)
end
# Unlocks the sources of the Pods.
#
# @todo Why the @pod_installers might be empty?
#
def
unlock_pod_sources
return
unless
@pod_installers
@pod_installers
.
each
do
|
installer
|
pod_target
=
pod_targets
.
find
{
|
target
|
target
.
pod_name
==
installer
.
name
}
installer
.
unlock_files!
(
pod_target
.
file_accessors
)
end
end
# Locks the sources of the Pods if the config instructs to do so.
#
# @todo Why the @pod_installers might be empty?
...
...
@@ -444,6 +462,7 @@ module Pod
# @return [void]
#
def
perform_post_install_actions
unlock_pod_sources
run_plugins_post_install_hooks
warn_for_deprecations
lock_pod_sources
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
befcc909
...
...
@@ -74,12 +74,22 @@ module Pod
#
def
lock_files!
(
file_accessors
)
return
if
local?
each_source_file
(
file_accessors
)
do
|
source_file
|
FileUtils
.
chmod
(
'u-w'
,
source_file
)
end
end
file_accessors
.
each
do
|
file_accessor
|
file_accessor
.
source_files
.
each
do
|
source_file
|
next
unless
source_file
.
exist?
FileUtils
.
chmod
(
'-w'
,
source_file
)
end
# Unlocks the source files if appropriate.
#
# @todo As the pre install hooks need to run before cleaning this
# method should be refactored.
#
# @return [void]
#
def
unlock_files!
(
file_accessors
)
return
if
local?
each_source_file
(
file_accessors
)
do
|
source_file
|
FileUtils
.
chmod
(
'u+w'
,
source_file
)
end
end
...
...
@@ -172,6 +182,15 @@ module Pod
!
local?
&&
!
head_pod?
&&
!
predownloaded?
&&
sandbox
.
specification
(
root_spec
.
name
)
!=
root_spec
end
def
each_source_file
(
file_accessors
,
&
blk
)
file_accessors
.
each
do
|
file_accessor
|
file_accessor
.
source_files
.
each
do
|
source_file
|
next
unless
source_file
.
exist?
blk
[
source_file
]
end
end
end
#-----------------------------------------------------------------------#
end
end
...
...
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