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
31a02728
Commit
31a02728
authored
Oct 22, 2011
by
Nolan Waite
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pod installer creates workspace
parent
41391400
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
installer.rb
lib/cocoapods/installer.rb
+13
-0
workspace.rb
lib/cocoapods/xcode/workspace.rb
+9
-5
integration_spec.rb
spec/integration_spec.rb
+16
-0
No files found.
lib/cocoapods/installer.rb
View file @
31a02728
...
...
@@ -89,5 +89,18 @@ module Pod
build_specifications
.
each
(
&
:post_install
)
end
def
configure_project
(
projpath
)
root
=
File
.
dirname
(
projpath
)
xcworkspace
=
File
.
join
(
root
,
File
.
basename
(
projpath
,
'.xcodeproj'
)
+
'.xcworkspace'
)
workspace
=
Xcode
::
Workspace
.
new_from_xcworkspace
(
xcworkspace
)
paths
=
[
projpath
]
paths
<<
File
.
join
(
config
.
project_pods_root
,
File
.
dirname
(
xcodeproj
.
template_file
))
root
=
Pathname
.
new
(
root
).
expand_path
paths
.
each
do
|
path
|
workspace
<<
Pathname
.
new
(
path
).
expand_path
.
relative_path_from
(
root
)
end
workspace
.
save_as
(
xcworkspace
)
end
end
end
lib/cocoapods/xcode/workspace.rb
View file @
31a02728
...
...
@@ -8,16 +8,20 @@ module Pod
@projpaths
=
projpaths
end
def
self
.
from_xcworkspace
(
path
)
from_s
(
File
.
read
(
File
.
join
(
path
,
'contents.xcworkspacedata'
)))
def
self
.
new_from_xcworkspace
(
path
)
begin
from_s
(
File
.
read
(
File
.
join
(
path
,
'contents.xcworkspacedata'
)))
rescue
Errno
::
ENOENT
new
end
end
def
self
.
from_s
(
xml
)
doc
=
NSXMLDocument
.
alloc
.
initWithXMLString
(
xml
,
options
:
0
,
error
:nil
)
projpaths
=
doc
.
nodesForXPath
(
"/Workspace/FileRef"
,
error
:nil
).
map
do
|
node
|
node
.
attribute
With
Name
(
"location"
).
stringValue
.
sub
(
/^group:/
,
''
)
node
.
attribute
For
Name
(
"location"
).
stringValue
.
sub
(
/^group:/
,
''
)
end
new
(
projpaths
)
new
(
*
projpaths
)
end
attr_reader
:projpaths
...
...
@@ -29,7 +33,7 @@ module Pod
TEMPLATE
=
%q[<?xml version="1.0" encoding="UTF-8"?><Workspace version="1.0"></Workspace>]
def
to_s
doc
=
NSXMLDocument
.
alloc
.
initWithXMLString
(
TEMPLATE
,
options
:
0
,
error
:nil
)
@projpaths
.
each
do
|
projpath
|
@projpaths
.
uniq
.
each
do
|
projpath
|
el
=
NSXMLNode
.
elementWithName
(
"FileRef"
)
el
.
addAttribute
(
NSXMLNode
.
attributeWithName
(
"location"
,
stringValue
:"group:
#{
projpath
}
"
))
doc
.
rootElement
.
addChild
(
el
)
...
...
spec/integration_spec.rb
View file @
31a02728
...
...
@@ -131,6 +131,22 @@ else
project
=
Pod
::
Xcode
::
Project
.
new
(
config
.
project_pods_root
)
project
.
source_files
.
should
==
installer
.
xcodeproj
.
source_files
end
it
"sets up an existing project with pods"
do
basename
=
platform
==
:ios
?
'iPhone'
:
'Mac'
projpath
=
temporary_directory
+
'ASIHTTPRequest.xcodeproj'
FileUtils
.
cp_r
(
fixture
(
"integration/ASIHTTPRequest/
#{
basename
}
.xcodeproj"
),
projpath
)
spec
=
Pod
::
Podfile
.
new
do
self
.
platform
platform
dependency
'SSZipArchive'
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
installer
.
configure_project
(
projpath
)
xcworkspace
=
temporary_directory
+
'ASIHTTPRequest.xcworkspace'
workspace
=
Pod
::
Xcode
::
Workspace
.
new_from_xcworkspace
(
xcworkspace
)
workspace
.
projpaths
.
sort
.
should
==
[
'ASIHTTPRequest.xcodeproj'
,
'Pods/Pods.xcodeproj'
]
end
end
end
end
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