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
781b347a
Commit
781b347a
authored
Dec 18, 2014
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write the spec version in the generated Info.plist
parent
17d5bc89
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
info_plist_file.rb
lib/cocoapods/generator/info_plist_file.rb
+14
-2
info_plist_file_spec.rb
spec/unit/generator/info_plist_file_spec.rb
+17
-0
No files found.
lib/cocoapods/generator/info_plist_file.rb
View file @
781b347a
...
@@ -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>
...
...
spec/unit/generator/info_plist_file_spec.rb
View file @
781b347a
...
@@ -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'
...
...
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