Commit 9d6fc4cd authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4444 from CocoaPods/seg-info-plist-version

[InfoPlistFile] Ensure the version string is exactly three dot-separated numbers
parents 9f06feed 49fc7094
......@@ -53,6 +53,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins)
[#2169](https://github.com/CocoaPods/CocoaPods/issues/2169)
* Ensure that generated `Info.plist` files have a `CFBundleShortVersionString`
that is precisely three dot-separated numbers.
[Samuel Giddins](https://github.com/segiddins)
[#4421](https://github.com/CocoaPods/CocoaPods/issues/4421)
## 0.39.0 (2015-10-09)
......
......@@ -39,7 +39,8 @@ module Pod
#
def target_version
if target && target.respond_to?(:root_spec)
target.root_spec.version.to_s
version = target.root_spec.version
[version.major, version.minor, version.patch].join('.')
else
'1.0.0'
end
......
......@@ -7,6 +7,43 @@ describe Pod::Generator::InfoPlistFile do
generator.target_version.should == '1.0.0'
end
describe 'sanitization' do
before do
@root_spec = mock('RootSpec')
pod_target = stub('PodTarget', :root_spec => @root_spec)
@generator = Pod::Generator::InfoPlistFile.new(pod_target)
end
it 'handles when the version is HEAD' do
version = Pod::Version.new('0.2.0')
version.head = true
@root_spec.stubs(:version).returns(version)
@generator.target_version.should == '0.2.0'
end
it 'handles when the version is more than 3 numeric parts' do
version = Pod::Version.new('0.2.0.1')
@root_spec.stubs(:version).returns(version)
@generator.target_version.should == '0.2.0'
end
it 'handles when the version is less than 3 numeric parts' do
version = Pod::Version.new('0.2')
@root_spec.stubs(:version).returns(version)
@generator.target_version.should == '0.2.0'
end
it 'handles when the version is a pre-release' do
version = Pod::Version.new('1.0.0-beta.1')
@root_spec.stubs(:version).returns(version)
@generator.target_version.should == '1.0.0'
version = Pod::Version.new('1.0-beta.5')
@root_spec.stubs(:version).returns(version)
@generator.target_version.should == '1.0.0'
end
end
it 'returns the specification\'s version for the pod target' do
generator = Pod::Generator::InfoPlistFile.new(fixture_pod_target('orange-framework/OrangeFramework.podspec'))
generator.target_version.should == '0.1.0'
......
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