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
bf3ae971
Commit
bf3ae971
authored
Apr 15, 2014
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored Command::Outdated to make it stub-able
parent
3ece3e70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
24 deletions
+63
-24
outdated.rb
lib/cocoapods/command/outdated.rb
+54
-24
outdated_spec.rb
spec/functional/command/outdated_spec.rb
+9
-0
No files found.
lib/cocoapods/command/outdated.rb
View file @
bf3ae971
...
...
@@ -23,26 +23,6 @@ module Pod
# @todo fix.
#
def
run
verify_podfile_exists!
verify_lockfile_exists!
lockfile
=
config
.
lockfile
pods
=
lockfile
.
pod_names
updates
=
[]
deprecated
=
[]
pods
.
each
do
|
pod_name
|
set
=
SourcesManager
.
search
(
Dependency
.
new
(
pod_name
))
next
unless
set
spec
=
set
.
specification
source_version
=
set
.
versions
.
first
lockfile_version
=
lockfile
.
version
(
pod_name
)
if
source_version
>
lockfile_version
updates
<<
[
pod_name
,
lockfile_version
,
source_version
]
end
if
spec
.
deprecated
||
spec
.
deprecated_in_favor_of
deprecated
<<
spec
end
end
if
updates
.
empty?
UI
.
puts
"No updates are available."
.
yellow
...
...
@@ -54,12 +34,12 @@ module Pod
end
end
if
deprecated
.
any?
if
deprecated
_pods
.
any?
UI
.
section
'The following pods are deprecated:'
do
deprecated
.
each
do
|
spec
|
deprecated
_pods
.
each
do
|
spec
|
if
spec
.
deprecated_in_favor_of
UI
.
puts
"-
#{
spec
.
name
}
in
"
\
"
favor of
#{
spec
.
deprecated_in_favor_of
}
"
UI
.
puts
"-
#{
spec
.
name
}
"
\
"
(in favor of
#{
spec
.
deprecated_in_favor_of
}
)
"
else
UI
.
puts
"-
#{
spec
.
name
}
"
end
...
...
@@ -68,6 +48,56 @@ module Pod
end
end
private
def
updates
@updates
||=
begin
spec_sets
.
map
do
|
set
|
spec
=
set
.
specification
source_version
=
set
.
versions
.
first
pod_name
=
spec
.
name
lockfile_version
=
lockfile
.
version
(
pod_name
)
if
source_version
>
lockfile_version
[
pod_name
,
lockfile_version
,
source_version
]
else
nil
end
end
.
compact
.
uniq
end
end
def
deprecated_pods
@deprecated_pods
||=
begin
spec_sets
.
map
(
&
:specification
).
select
do
|
spec
|
spec
.
deprecated
||
spec
.
deprecated_in_favor_of
end
.
compact
.
uniq
end
end
def
spec_sets
@spec_sets
||=
begin
installed_pods
.
map
do
|
pod_name
|
SourcesManager
.
search
(
Dependency
.
new
(
pod_name
))
end
.
compact
.
uniq
end
end
def
installed_pods
@installed_pods
||=
begin
verify_podfile_exists!
lockfile
.
pod_names
end
end
def
lockfile
@lockfile
||=
begin
verify_lockfile_exists!
config
.
lockfile
end
end
end
end
end
...
...
spec/functional/command/outdated_spec.rb
View file @
bf3ae971
...
...
@@ -17,6 +17,15 @@ module Pod
exception
.
message
.
should
.
include
"No `Podfile.lock' found in the current working directory"
end
end
it
'tells the user about deprecated pods'
do
spec
=
Specification
.
new
(
nil
,
'AFNetworking'
)
spec
.
deprecated_in_favor_of
=
'BlocksKit'
Command
::
Outdated
.
any_instance
.
stubs
(
:deprecated_pods
).
returns
([
spec
])
Command
::
Outdated
.
any_instance
.
stubs
(
:updates
).
returns
([])
run_command
(
'outdated'
,
'--no-repo-update'
)
UI
.
output
.
should
.
include
(
'in favor of BlocksKit'
)
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