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
d8cb489a
Commit
d8cb489a
authored
Mar 12, 2016
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Command::Update] Extract #verify_pods_are_installed!
Increases code readability.
parent
368f89ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
project.rb
lib/cocoapods/command/project.rb
+21
-18
No files found.
lib/cocoapods/command/project.rb
View file @
d8cb489a
...
@@ -73,30 +73,33 @@ module Pod
...
@@ -73,30 +73,33 @@ module Pod
super
super
end
end
# Check if all given pods are installed
#
def
verify_pods_are_installed!
lockfile_roots
=
config
.
lockfile
.
pod_names
.
map
{
|
p
|
Specification
.
root_name
(
p
)
}
missing_pods
=
@pods
.
map
{
|
p
|
Specification
.
root_name
(
p
)
}.
select
do
|
pod
|
!
lockfile_roots
.
include?
(
pod
)
end
unless
missing_pods
.
empty?
message
=
if
missing_pods
.
length
>
1
"Pods `
#{
missing_pods
.
join
(
'`, `'
)
}
` are not "
\
'installed and cannot be updated'
else
"The `
#{
missing_pods
.
first
}
` Pod is not installed "
\
'and cannot be updated'
end
raise
Informative
,
message
end
end
def
run
def
run
verify_podfile_exists!
verify_podfile_exists!
installer
=
installer_for_config
installer
=
installer_for_config
if
@pods
if
@pods
verify_lockfile_exists!
verify_lockfile_exists!
verify_pods_are_installed!
# Check if all given pods are installed
lockfile_roots
=
config
.
lockfile
.
pod_names
.
map
{
|
p
|
Specification
.
root_name
(
p
)
}
missing_pods
=
@pods
.
map
{
|
p
|
Specification
.
root_name
(
p
)
}.
select
do
|
pod
|
!
lockfile_roots
.
include?
(
pod
)
end
unless
missing_pods
.
empty?
message
=
if
missing_pods
.
length
>
1
"Pods `
#{
missing_pods
.
join
(
'`, `'
)
}
` are not "
\
'installed and cannot be updated'
else
"The `
#{
missing_pods
.
first
}
` Pod is not installed "
\
'and cannot be updated'
end
raise
Informative
,
message
end
installer
.
update
=
{
:pods
=>
@pods
}
installer
.
update
=
{
:pods
=>
@pods
}
else
else
UI
.
puts
'Update all pods'
.
yellow
unless
@pods
UI
.
puts
'Update all pods'
.
yellow
unless
@pods
...
...
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