Commit 1b6e63fb authored by Danielle Tomlinson's avatar Danielle Tomlinson Committed by GitHub

Merge pull request #5951 from CocoaPods/dani_validator_errors

[Validator] Inform people of .swift-version on err
parents a5a409a8 2f1c364d
......@@ -13,6 +13,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[#5934](https://github.com/CocoaPods/CocoaPods/pull/5934)
* Improve performance of PathList.read_file_system
* Tell users about the .swift-version file on validation failures.
[Danielle Tomlinson](https://github.com/dantoml)
[#5951](https://github.com/CocoaPods/CocoaPods/pull/5951)
* Improve performance of PathList.read_file_system
[Heath Borders](https://github.com/hborders)
[#5890](https://github.com/CocoaPods/CocoaPods/issues/5890)
......
......@@ -142,7 +142,15 @@ module Pod
reasons << 'all results apply only to public specs, but you can use ' \
'`--private` to ignore them if linting the specification for a private pod'
end
reasons.to_sentence
if dot_swift_version.nil?
reasons.to_sentence + ".\n[!] The validator for Swift projects uses " \
'Swift 2.3 by default, if you are using a different version of ' \
'swift you can use a `.swift-version` file to set the version for ' \
"your Pod. For example to use Swift 3.0, run: \n" \
' `echo "3.0" > .swift-version`'
else
reasons.to_sentence
end
end
#-------------------------------------------------------------------------#
......
......@@ -812,6 +812,21 @@ module Pod
validator.results.count.should == 0
end
it 'tells users about the .swift-version file if the validation fails' do
Specification.any_instance.stubs(:deployment_target).returns('9.0')
validator = test_swiftpod
validator.stubs(:validated?).returns(false)
result = Validator::Result.new(:error, 'attribute', 'message')
validator.stubs(:results).returns([result])
validator.failure_reason.should == "1 error.\n[!] The validator for " \
'Swift projects uses Swift 2.3 by default, if you are using a ' \
'different version of swift you can use a `.swift-version` file ' \
'to set the version for your Pod. For example to use Swift 3.0, ' \
"run: \n `echo \"3.0\" > .swift-version`"
end
describe '#swift_version' do
it 'defaults to Swift 2.3' do
validator = test_swiftpod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment