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
e08a67a6
Commit
e08a67a6
authored
Nov 05, 2011
by
Nolan Waite
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Template maintains its project
parent
5129dcdc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
26 deletions
+21
-26
installer.rb
lib/cocoapods/installer.rb
+15
-20
project_template.rb
lib/cocoapods/project_template.rb
+4
-4
integration_spec.rb
spec/integration_spec.rb
+2
-2
project_spec.rb
spec/unit/xcode/project_spec.rb
+0
-0
No files found.
lib/cocoapods/installer.rb
View file @
e08a67a6
...
...
@@ -133,31 +133,26 @@ module Pod
end
def
template
@template
||=
ProjectTemplate
.
new
(
@podfile
.
platform
)
end
def
xcodeproj
unless
@xcodeproj
@xcodeproj
=
Xcode
::
Project
.
new
(
template
.
xcodeproj_path
)
# First we need to resolve dependencies across *all* targets, so that the
# same correct versions of pods are being used for all targets. This
# happens when we call `build_specifications'.
build_specifications
.
each
do
|
spec
|
# Add all source files to the project grouped by pod
group
=
xcodeproj
.
add_pod_group
(
spec
.
name
)
spec
.
expanded_source_files
.
each
do
|
path
|
group
.
children
.
new
(
'path'
=>
path
.
to_s
)
end
return
@template
if
@template
@template
=
ProjectTemplate
.
new
(
@podfile
.
platform
)
# First we need to resolve dependencies across *all* targets, so that the
# same correct versions of pods are being used for all targets. This
# happens when we call `build_specifications'.
build_specifications
.
each
do
|
spec
|
# Add all source files to the project grouped by pod
group
=
@template
.
project
.
add_pod_group
(
spec
.
name
)
spec
.
expanded_source_files
.
each
do
|
path
|
group
.
children
.
new
(
'path'
=>
path
.
to_s
)
end
# Add a group to hold all the target support files
xcodeproj
.
main_group
.
groups
.
new
(
'name'
=>
'Targets Support Files'
)
end
@xcodeproj
# Add a group to hold all the target support files
@template
.
project
.
main_group
.
groups
.
new
(
'name'
=>
'Targets Support Files'
)
@template
end
def
targets
@targets
||=
@podfile
.
targets
.
values
.
map
do
|
target_definition
|
Target
.
new
(
@podfile
,
xcodeproj
,
target_definition
)
Target
.
new
(
@podfile
,
template
.
project
,
target_definition
)
end
end
...
...
@@ -176,7 +171,7 @@ module Pod
end
pbxproj
=
File
.
join
(
root
,
'Pods.xcodeproj'
)
puts
" * Writing Xcode project file to `
#{
pbxproj
}
'"
if
config
.
verbose?
xcodeproj
.
save_as
(
pbxproj
)
template
.
project
.
save_as
(
pbxproj
)
# Post install hooks run last!
targets
.
each
do
|
target
|
...
...
lib/cocoapods/project_template.rb
View file @
e08a67a6
...
...
@@ -4,8 +4,11 @@ module Pod
class
ProjectTemplate
def
initialize
(
platform
)
@platform
=
platform
@project
=
Xcode
::
Project
.
new
(
File
.
join
(
path
,
'Pods.xcodeproj'
))
end
attr_reader
:project
# TODO this is a workaround for an issue with MacRuby with compiled files
# that makes the use of __FILE__ impossible.
#
...
...
@@ -34,12 +37,9 @@ module Pod
end
end
def
xcodeproj_path
@xcodeproj_path
=
File
.
join
(
path
,
'Pods.xcodeproj'
)
end
def
copy_to
(
pods_root
)
FileUtils
.
cp_r
(
"
#{
path
}
/."
,
pods_root
)
@project
.
save_as
(
File
.
join
(
pods_root
,
'Pods.xcodeproj'
))
end
end
end
spec/integration_spec.rb
View file @
e08a67a6
...
...
@@ -77,7 +77,7 @@ else
(
root
+
'Pods.xcconfig'
).
read
.
should
==
installer
.
targets
.
first
.
xcconfig
.
to_s
project_file
=
(
root
+
'Pods.xcodeproj/project.pbxproj'
).
to_s
NSDictionary
.
dictionaryWithContentsOfFile
(
project_file
).
should
==
installer
.
xcodeproj
.
to_hash
NSDictionary
.
dictionaryWithContentsOfFile
(
project_file
).
should
==
installer
.
template
.
project
.
to_hash
puts
"
\n
[!] Compiling static library..."
Dir
.
chdir
(
config
.
project_pods_root
)
do
...
...
@@ -144,7 +144,7 @@ else
installer
.
install!
project
=
Pod
::
Xcode
::
Project
.
new
(
config
.
project_pods_root
+
'Pods.xcodeproj'
)
project
.
source_files
.
should
==
installer
.
xcodeproj
.
source_files
project
.
source_files
.
should
==
installer
.
template
.
project
.
source_files
end
it
"creates a project with multiple targets"
do
...
...
spec/unit/xcode/project_spec.rb
View file @
e08a67a6
This diff is collapsed.
Click to expand it.
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