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
5bead517
Commit
5bead517
authored
Apr 17, 2014
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[UserProjectIntegrator] Add support for Xcodeproj::Workspace::FileReference
See
https://github.com/CocoaPods/Xcodeproj/pull/150
parent
4cc28f76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
23 deletions
+31
-23
Gemfile.lock
Gemfile.lock
+2
-2
user_project_integrator.rb
lib/cocoapods/installer/user_project_integrator.rb
+7
-6
user_project_integrator_spec.rb
spec/unit/installer/user_project_integrator_spec.rb
+22
-15
No files found.
Gemfile.lock
View file @
5bead517
...
...
@@ -18,7 +18,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: 6
d0bc86794e1bc727cbec76e6ffc5393b8c04306
revision: 6
0c297e6dd8b04ba055b1350d72a7ef0f1092879
branch: master
specs:
xcodeproj (0.16.1)
...
...
@@ -27,7 +27,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-downloader.git
revision:
c004c28547c0a670a15bc7cef195d7b9e1944c0d
revision:
224c8a191ef6b98d538d6228b0549d05194944ee
branch: master
specs:
cocoapods-downloader (0.5.0)
...
...
lib/cocoapods/installer/user_project_integrator.rb
View file @
5bead517
...
...
@@ -81,21 +81,22 @@ module Pod
#
def
create_workspace
all_projects
=
user_project_paths
.
sort
.
push
(
sandbox
.
project_path
).
uniq
projpaths
=
all_projects
.
map
do
|
path
|
path
.
relative_path_from
(
workspace_path
.
dirname
).
to_s
file_references
=
all_projects
.
map
do
|
path
|
relative_path
=
path
.
relative_path_from
(
workspace_path
.
dirname
).
to_s
Xcodeproj
::
Workspace
::
FileReference
.
new
(
relative_path
,
'group'
)
end
if
workspace_path
.
exist?
workspace
=
Xcodeproj
::
Workspace
.
new_from_xcworkspace
(
workspace_path
)
new_
projpaths
=
projpaths
-
workspace
.
projpath
s
unless
new_
projpath
s
.
empty?
workspace
.
projpaths
.
concat
(
new_projpath
s
)
new_
file_references
=
file_references
-
workspace
.
file_reference
s
unless
new_
file_reference
s
.
empty?
workspace
.
file_references
.
concat
(
new_file_reference
s
)
workspace
.
save_as
(
workspace_path
)
end
else
UI
.
notice
"From now on use `
#{
workspace_path
.
basename
}
`."
workspace
=
Xcodeproj
::
Workspace
.
new
(
*
projpath
s
)
workspace
=
Xcodeproj
::
Workspace
.
new
(
*
file_reference
s
)
workspace
.
save_as
(
workspace_path
)
end
end
...
...
spec/unit/installer/user_project_integrator_spec.rb
View file @
5bead517
...
...
@@ -34,7 +34,10 @@ module Pod
@integrator
.
integrate!
workspace_path
=
@integrator
.
send
(
:workspace_path
)
workspace
=
Xcodeproj
::
Workspace
.
new_from_xcworkspace
(
workspace_path
)
workspace
.
projpaths
.
find
{
|
path
|
path
=~
/Pods.xcodeproj/
}.
should
.
not
.
be
.
nil
pods_project_ref
=
workspace
.
file_references
.
find
do
|
ref
|
ref
.
path
=~
/Pods.xcodeproj/
end
pods_project_ref
.
should
.
not
.
be
.
nil
end
it
"integrates the user targets"
do
...
...
@@ -60,7 +63,7 @@ module Pod
@integrator
.
send
(
:create_workspace
)
workspace_path
=
@integrator
.
send
(
:workspace_path
)
saved
=
Xcodeproj
::
Workspace
.
new_from_xcworkspace
(
workspace_path
)
saved
.
projpaths
.
should
==
[
saved
.
file_references
.
map
(
&
:path
)
.
should
==
[
"SampleProject/SampleProject.xcodeproj"
,
"Pods/Pods.xcodeproj"
]
...
...
@@ -68,22 +71,24 @@ module Pod
it
"updates an existing workspace if needed"
do
workspace_path
=
@integrator
.
send
(
:workspace_path
)
workspace
=
Xcodeproj
::
Workspace
.
new
(
'SampleProject/SampleProject.xcodeproj'
)
ref
=
Xcodeproj
::
Workspace
::
FileReference
.
new
(
'SampleProject/SampleProject.xcodeproj'
,
'group'
)
workspace
=
Xcodeproj
::
Workspace
.
new
(
ref
)
workspace
.
save_as
(
workspace_path
)
@integrator
.
send
(
:create_workspace
)
saved
=
Xcodeproj
::
Workspace
.
new_from_xcworkspace
(
workspace_path
)
saved
.
projpaths
.
should
==
[
saved
.
file_references
.
map
(
&
:path
)
.
should
==
[
"SampleProject/SampleProject.xcodeproj"
,
"Pods/Pods.xcodeproj"
]
end
it
"doesn't write the workspace if not needed"
do
projpath
s
=
[
"SampleProject/SampleProject.xcodeproj"
,
"Pods/Pods.xcodeproj"
file_reference
s
=
[
Xcodeproj
::
Workspace
::
FileReference
.
new
(
'SampleProject/SampleProject.xcodeproj'
,
'group'
)
,
Xcodeproj
::
Workspace
::
FileReference
.
new
(
'Pods/Pods.xcodeproj'
,
'group'
)
]
workspace
=
Xcodeproj
::
Workspace
.
new
(
projpaths
)
workspace
=
Xcodeproj
::
Workspace
.
new
(
file_references
)
workspace_path
=
@integrator
.
send
(
:workspace_path
)
workspace
.
save_as
(
workspace_path
)
Xcodeproj
::
Workspace
.
expects
(
:save_as
).
never
...
...
@@ -91,12 +96,13 @@ module Pod
end
it
"only appends projects to the workspace and never deletes one"
do
workspace
=
Xcodeproj
::
Workspace
.
new
(
'user_added_project.xcodeproj'
)
ref
=
Xcodeproj
::
Workspace
::
FileReference
.
new
(
'user_added_project.xcodeproj'
,
'group'
)
workspace
=
Xcodeproj
::
Workspace
.
new
(
ref
)
workspace_path
=
@integrator
.
send
(
:workspace_path
)
workspace
.
save_as
(
workspace_path
)
@integrator
.
send
(
:create_workspace
)
saved
=
Xcodeproj
::
Workspace
.
new_from_xcworkspace
(
workspace_path
)
saved
.
projpaths
.
should
==
[
saved
.
file_references
.
map
(
&
:path
)
.
should
==
[
'user_added_project.xcodeproj'
,
"SampleProject/SampleProject.xcodeproj"
,
"Pods/Pods.xcodeproj"
...
...
@@ -104,16 +110,17 @@ module Pod
end
it
"preserves the order of the projects in the workspace"
do
projpath
s
=
[
"Pods/Pods.xcodeproj"
,
"SampleProject/SampleProject.xcodeproj"
,
file_reference
s
=
[
Xcodeproj
::
Workspace
::
FileReference
.
new
(
'Pods/Pods.xcodeproj'
,
'group'
)
,
Xcodeproj
::
Workspace
::
FileReference
.
new
(
'SampleProject/SampleProject.xcodeproj'
,
'group'
)
,
]
workspace
=
Xcodeproj
::
Workspace
.
new
(
projpaths
)
workspace
=
Xcodeproj
::
Workspace
.
new
(
file_references
)
workspace_path
=
@integrator
.
send
(
:workspace_path
)
workspace
.
save_as
(
workspace_path
)
@integrator
.
send
(
:create_workspace
)
saved
=
Xcodeproj
::
Workspace
.
new_from_xcworkspace
(
workspace_path
)
saved
.
projpaths
.
should
==
[
saved
.
file_references
.
map
(
&
:path
)
.
should
==
[
"Pods/Pods.xcodeproj"
,
"SampleProject/SampleProject.xcodeproj"
,
]
...
...
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