Commit 781b347a authored by Marius Rackwitz's avatar Marius Rackwitz

Write the spec version in the generated Info.plist

parent 17d5bc89
...@@ -29,12 +29,24 @@ module Pod ...@@ -29,12 +29,24 @@ module Pod
end end
end end
# The version associated with the current target
#
# @return [String]
#
def target_version
if target && target.respond_to?(:root_spec)
target.root_spec.version.to_s
else
'1.0.0'
end
end
# Generates the contents of the Info.plist # Generates the contents of the Info.plist
# #
# @return [String] # @return [String]
# #
def generate def generate
FILE_CONTENTS FILE_CONTENTS.sub('${CURRENT_PROJECT_VERSION_STRING}', target_version)
end end
FILE_CONTENTS = <<-EOS FILE_CONTENTS = <<-EOS
...@@ -55,7 +67,7 @@ module Pod ...@@ -55,7 +67,7 @@ module Pod
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0</string> <string>${CURRENT_PROJECT_VERSION_STRING}</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -2,6 +2,23 @@ require File.expand_path('../../../spec_helper', __FILE__) ...@@ -2,6 +2,23 @@ require File.expand_path('../../../spec_helper', __FILE__)
describe Pod::Generator::InfoPlistFile do describe Pod::Generator::InfoPlistFile do
describe '#target_version' do
it 'returns 1.0.0 for the aggregate target' do
generator = Pod::Generator::InfoPlistFile.new(fixture_aggregate_target)
generator.target_version.should == '1.0.0'
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'
end
end
it 'replaces the version in the generated plist' do
generator = Pod::Generator::InfoPlistFile.new(fixture_pod_target('orange-framework/OrangeFramework.podspec'))
generator.generate.should.include "<key>CFBundleShortVersionString</key>\n <string>0.1.0</string>"
end
it 'generates a valid Info.plist file' do it 'generates a valid Info.plist file' do
generator = Pod::Generator::InfoPlistFile.new(mock('Target')) generator = Pod::Generator::InfoPlistFile.new(mock('Target'))
file = temporary_directory + 'Info.plist' file = temporary_directory + 'Info.plist'
......
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