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
46073589
Commit
46073589
authored
Oct 17, 2016
by
Orta Therox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds support in the validator for expressing what version of Swift was used during validation
parent
8ee37c39
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
0 deletions
+33
-0
CHANGELOG.md
CHANGELOG.md
+4
-0
validator.rb
lib/cocoapods/validator.rb
+7
-0
validator_spec.rb
spec/unit/validator_spec.rb
+22
-0
No files found.
CHANGELOG.md
View file @
46073589
...
@@ -20,6 +20,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -20,6 +20,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Uku Loskit
](
https://github.com/UkuLoskit
)
[
Uku Loskit
](
https://github.com/UkuLoskit
)
[
#6037
](
https://github.com/CocoaPods/CocoaPods/issues/6037
)
[
#6037
](
https://github.com/CocoaPods/CocoaPods/issues/6037
)
*
The validator has an API for accessing which version of Swift was used.
[
Orta Therox
](
https://github.com/orta
)
[
#6049
](
https://github.com/CocoaPods/CocoaPods/pull/6049
)
##### Bug Fixes
##### Bug Fixes
...
...
lib/cocoapods/validator.rb
View file @
46073589
...
@@ -262,6 +262,13 @@ module Pod
...
@@ -262,6 +262,13 @@ module Pod
swift_version_path
.
read
if
swift_version_path
.
exist?
swift_version_path
.
read
if
swift_version_path
.
exist?
end
end
# @return [String] A string representing the Swift version used during linting
# or nil, if Swift was not used.
#
def
used_swift_version
swift_version
if
@installer
.
pod_targets
.
any?
(
&
:uses_swift?
)
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
private
private
...
...
spec/unit/validator_spec.rb
View file @
46073589
...
@@ -868,7 +868,29 @@ module Pod
...
@@ -868,7 +868,29 @@ module Pod
validator
.
dot_swift_version
.
should
==
'1.0'
validator
.
dot_swift_version
.
should
==
'1.0'
end
end
end
end
describe
'Getting the Swift value used by the validator'
do
it
'passes nil when no targets have used Swift'
do
validator
=
test_swiftpod
pod_target
=
stub
(
:uses_swift?
=>
true
)
installer
=
stub
(
:pod_targets
=>
[
pod_target
])
validator
.
instance_variable_set
(
:@installer
,
installer
)
validator
.
stubs
(
:dot_swift_version
).
returns
(
'1.2.3'
)
validator
.
used_swift_version
.
should
==
'1.2.3'
end
it
'returns the swift_version when a target has used Swift'
do
validator
=
test_swiftpod
pod_target
=
stub
(
:uses_swift?
=>
false
)
installer
=
stub
(
:pod_targets
=>
[
pod_target
])
validator
.
instance_variable_set
(
:@installer
,
installer
)
validator
.
used_swift_version
.
should
.
nil?
end
end
end
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