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
61afb0d9
Commit
61afb0d9
authored
Aug 23, 2017
by
Danielle Tomlinson
Committed by
GitHub
Aug 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6971 from CocoaPods/dani_validation
Fix validation when using --swift-version
parents
191eff09
2dd3f607
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
10 deletions
+37
-10
CHANGELOG.md
CHANGELOG.md
+5
-0
validator.rb
lib/cocoapods/validator.rb
+11
-2
validator_spec.rb
spec/unit/validator_spec.rb
+21
-8
No files found.
CHANGELOG.md
View file @
61afb0d9
...
@@ -26,6 +26,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -26,6 +26,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6948
](
https://github.com/CocoaPods/CocoaPods/pull/6948
)
[
#6948
](
https://github.com/CocoaPods/CocoaPods/pull/6948
)
*
Fix validation warnings when using --swift-version
[
Danielle Tomlinson
](
https://github.com/dantoml
)
[
#6971
](
https://github.com/CocoaPods/CocoaPods/issue/6971
)
## 1.3.1 (2017-08-02)
## 1.3.1 (2017-08-02)
##### Enhancements
##### Enhancements
...
...
lib/cocoapods/validator.rb
View file @
61afb0d9
...
@@ -14,6 +14,10 @@ module Pod
...
@@ -14,6 +14,10 @@ module Pod
class
Validator
class
Validator
include
Config
::
Mixin
include
Config
::
Mixin
# The default version of Swift to use when linting pods
#
DEFAULT_SWIFT_VERSION
=
'3.0'
.
freeze
# @return [Specification::Linter] the linter instance from CocoaPods
# @return [Specification::Linter] the linter instance from CocoaPods
# Core.
# Core.
#
#
...
@@ -252,7 +256,12 @@ module Pod
...
@@ -252,7 +256,12 @@ module Pod
# @return [String] the SWIFT_VERSION to use for validation.
# @return [String] the SWIFT_VERSION to use for validation.
#
#
def
swift_version
def
swift_version
@swift_version
||=
dot_swift_version
||
'3.0'
return
@swift_version
if
defined?
(
@swift_version
)
if
version
=
dot_swift_version
@swift_version
=
version
else
DEFAULT_SWIFT_VERSION
end
end
end
# Set the SWIFT_VERSION that should be used to validate the pod.
# Set the SWIFT_VERSION that should be used to validate the pod.
...
@@ -386,7 +395,7 @@ module Pod
...
@@ -386,7 +395,7 @@ module Pod
end
end
def
validate_dot_swift_version
def
validate_dot_swift_version
if
!
used_swift_version
.
nil?
&&
dot_
swift_version
.
nil?
if
!
used_swift_version
.
nil?
&&
@
swift_version
.
nil?
warning
(
:swift_version
,
warning
(
:swift_version
,
'The validator for Swift projects uses '
\
'The validator for Swift projects uses '
\
'Swift 3.0 by default, if you are using a different version of '
\
'Swift 3.0 by default, if you are using a different version of '
\
...
...
spec/unit/validator_spec.rb
View file @
61afb0d9
...
@@ -931,7 +931,27 @@ module Pod
...
@@ -931,7 +931,27 @@ module Pod
validator
.
results
.
count
.
should
==
0
validator
.
results
.
count
.
should
==
0
end
end
it
'fails without the presence of a .swift-version file for Swift Pods'
do
describe
'with a user provided swift-version'
do
it
'succeeds with a --swift-version provided value'
do
Specification
.
any_instance
.
stubs
(
:deployment_target
).
returns
(
'9.0'
)
validator
=
test_swiftpod
validator
.
swift_version
=
'3.1.0'
validator
.
validate
validator
.
results
.
count
.
should
==
0
end
it
'succeeds with a .swift-version file'
do
Specification
.
any_instance
.
stubs
(
:deployment_target
).
returns
(
'9.0'
)
validator
=
test_swiftpod_with_dot_swift_version
validator
.
validate
validator
.
results
.
count
.
should
==
0
end
end
describe
'wihout a user provided swift version'
do
it
'warns for Swift Pods'
do
Specification
.
any_instance
.
stubs
(
:deployment_target
).
returns
(
'9.0'
)
Specification
.
any_instance
.
stubs
(
:deployment_target
).
returns
(
'9.0'
)
validator
=
test_swiftpod
validator
=
test_swiftpod
...
@@ -946,13 +966,6 @@ module Pod
...
@@ -946,13 +966,6 @@ module Pod
'to set the version for your Pod. For example to use Swift 2.3, '
\
'to set the version for your Pod. For example to use Swift 2.3, '
\
"run:
\n
`echo
\"
2.3
\"
> .swift-version`"
"run:
\n
`echo
\"
2.3
\"
> .swift-version`"
end
end
it
'succeeds with the presence of a .swift-version file for Swift Pods'
do
Specification
.
any_instance
.
stubs
(
:deployment_target
).
returns
(
'9.0'
)
validator
=
test_swiftpod_with_dot_swift_version
validator
.
validate
validator
.
results
.
count
.
should
==
0
end
end
describe
'#swift_version'
do
describe
'#swift_version'
do
...
...
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