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
91e23205
Commit
91e23205
authored
Nov 06, 2017
by
Markus Chmelar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add color indication to output of "pod outdated"
parent
5c0bd2c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
3 deletions
+79
-3
CHANGELOG.md
CHANGELOG.md
+4
-0
outdated.rb
lib/cocoapods/command/outdated.rb
+16
-2
outdated_spec.rb
spec/functional/command/outdated_spec.rb
+59
-1
No files found.
CHANGELOG.md
View file @
91e23205
...
@@ -8,6 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -8,6 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
##### Enhancements
*
Add color indication to output of
`pod outdated`
[
iv-mexx
](
https://github.com/iv-mexx
)
[
#7204
](
https://github.com/CocoaPods/CocoaPods/pull/7204
)
*
Add support for editing the podspec, license, README, license, and docs of local development pods
*
Add support for editing the podspec, license, README, license, and docs of local development pods
[
Eric Amorde
](
https://github.com/amorde
)
[
Eric Amorde
](
https://github.com/amorde
)
[
#7093
](
https://github.com/CocoaPods/CocoaPods/pull/7093
)
[
#7093
](
https://github.com/CocoaPods/CocoaPods/pull/7093
)
...
...
lib/cocoapods/command/outdated.rb
View file @
91e23205
...
@@ -22,10 +22,24 @@ module Pod
...
@@ -22,10 +22,24 @@ module Pod
if
updates
.
empty?
if
updates
.
empty?
UI
.
puts
'No pod updates are available.'
.
yellow
UI
.
puts
'No pod updates are available.'
.
yellow
else
else
UI
.
section
'The color indicates what happens when you run `pod update`'
do
UI
.
puts
"
#{
'<green>'
.
green
}
\t\t
- Will be updated to the newest version"
UI
.
puts
"
#{
'<yellow>'
.
yellow
}
\t
- Will be updated, but not to the newest version because of specified version in Podfile"
UI
.
puts
"
#{
'<red>'
.
red
}
\t\t
- Will not be updated because of specified version in Podfile"
UI
.
puts
''
end
UI
.
section
'The following pod updates are available:'
do
UI
.
section
'The following pod updates are available:'
do
updates
.
each
do
|
(
name
,
from_version
,
matching_version
,
to_version
)
|
updates
.
each
do
|
(
name
,
from_version
,
matching_version
,
to_version
)
|
UI
.
puts
"-
#{
name
}
#{
from_version
}
->
#{
matching_version
}
"
\
color
=
:yellow
"(latest version
#{
to_version
}
)"
if
matching_version
==
to_version
color
=
:green
elsif
from_version
==
matching_version
color
=
:red
end
# For the specs, its necessary that to_s is called here even though it is redundant
# https://github.com/CocoaPods/CocoaPods/pull/7204#issuecomment-342512015
UI
.
puts
"-
#{
name
}
#{
from_version
.
to_s
.
send
(
color
)
}
->
#{
matching_version
.
to_s
.
send
(
color
)
}
"
\
"(latest version
#{
to_version
.
to_s
}
)"
# rubocop:disable Lint/StringConversionInInterpolation
end
end
end
end
end
end
...
...
spec/functional/command/outdated_spec.rb
View file @
91e23205
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
module
Pod
module
Pod
describe
Command
::
Outdated
do
describe
Command
::
Outdated
do
extend
SpecHelper
::
TemporaryRepos
extend
SpecHelper
::
TemporaryRepos
...
@@ -39,6 +38,65 @@ module Pod
...
@@ -39,6 +38,65 @@ module Pod
UI
.
output
.
should
.
not
.
include
(
'UIKit'
)
UI
.
output
.
should
.
not
.
include
(
'UIKit'
)
end
end
it
'tells the user about outdated pods that can be updated in green'
do
pod_name
=
'BlocksKit'
current_version_string
=
mock
current_version_string
.
expects
(
:green
).
returns
(
'1.0'
).
once
current_version
=
mock
current_version
.
stubs
(
:to_s
).
returns
(
current_version_string
)
newest_version_string
=
mock
newest_version_string
.
stubs
(
:to_s
).
returns
(
'2.0'
)
newest_version_string
.
expects
(
:green
).
returns
(
'2.0'
).
once
newest_version
=
mock
newest_version
.
stubs
(
:to_s
).
returns
(
newest_version_string
)
Command
::
Outdated
.
any_instance
.
stubs
(
:updates
).
returns
([[
pod_name
,
current_version
,
newest_version
,
newest_version
]])
Command
::
Outdated
.
any_instance
.
stubs
(
:deprecated_pods
).
returns
([])
run_command
(
'outdated'
)
UI
.
output
.
should
.
include
(
'BlocksKit 1.0 -> 2.0 (latest version 2.0)'
)
end
it
'tells the user about outdated pods that can not be updated due to version restriction in red'
do
pod_name
=
'BlocksKit'
version_string
=
mock
version_string
.
expects
(
:red
).
returns
(
'1.0'
).
twice
current_version
=
mock
current_version
.
stubs
(
:to_s
).
returns
(
version_string
)
newest_version
=
mock
newest_version
.
stubs
(
:to_s
).
returns
(
'2.0'
)
Command
::
Outdated
.
any_instance
.
stubs
(
:updates
).
returns
([[
pod_name
,
current_version
,
current_version
,
newest_version
]])
Command
::
Outdated
.
any_instance
.
stubs
(
:deprecated_pods
).
returns
([])
run_command
(
'outdated'
)
UI
.
output
.
should
.
include
(
'BlocksKit 1.0 -> 1.0 (latest version 2.0)'
)
end
it
'tells the user about outdated pods that can be updated, but not to the latest version in yellow'
do
pod_name
=
'BlocksKit'
current_version_string
=
mock
current_version_string
.
expects
(
:yellow
).
returns
(
'1.0'
).
once
current_version
=
mock
current_version
.
stubs
(
:to_s
).
returns
(
current_version_string
)
next_version_string
=
mock
next_version_string
.
expects
(
:yellow
).
returns
(
'1.1'
).
once
next_version
=
mock
next_version
.
stubs
(
:to_s
).
returns
(
next_version_string
)
newest_version
=
mock
newest_version
.
stubs
(
:to_s
).
returns
(
'2.0'
)
Command
::
Outdated
.
any_instance
.
stubs
(
:updates
).
returns
([[
pod_name
,
current_version
,
next_version
,
newest_version
]])
Command
::
Outdated
.
any_instance
.
stubs
(
:deprecated_pods
).
returns
([])
run_command
(
'outdated'
)
UI
.
output
.
should
.
include
(
'BlocksKit 1.0 -> 1.1 (latest version 2.0)'
)
end
it
'tells the user about deprecated pods'
do
it
'tells the user about deprecated pods'
do
spec
=
Specification
.
new
(
nil
,
'AFNetworking'
)
spec
=
Specification
.
new
(
nil
,
'AFNetworking'
)
spec
.
deprecated_in_favor_of
=
'BlocksKit'
spec
.
deprecated_in_favor_of
=
'BlocksKit'
...
...
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