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
d1ba2e80
Commit
d1ba2e80
authored
Sep 16, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ xcode project spec
parent
3744f691
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
21 deletions
+84
-21
installer.rb
lib/cocoa_pods/installer.rb
+3
-3
project.rb
lib/cocoa_pods/xcode/project.rb
+12
-18
project_spec.rb
spec/unit/xcode/project_spec.rb
+69
-0
No files found.
lib/cocoa_pods/installer.rb
View file @
d1ba2e80
...
...
@@ -40,8 +40,8 @@ module Pod
})
end
def
xproj
@x
proj
||=
Xcode
::
Project
.
static_library
def
x
code
proj
@x
codeproj
||=
Xcode
::
Project
.
ios_
static_library
end
def
install!
...
...
@@ -64,7 +64,7 @@ module Pod
def
generate_project
puts
"==> Creating Pods project files"
unless
config
.
silent?
source_files
.
each
{
|
file
|
xproj
.
add_source_file
(
file
)
}
source_files
.
each
{
|
file
|
x
code
proj
.
add_source_file
(
file
)
}
build_specification_sets
.
each
do
|
set
|
xcconfig
<<
set
.
specification
.
read
(
:xcconfig
)
end
...
...
lib/cocoa_pods/xcode/project.rb
View file @
d1ba2e80
...
...
@@ -6,7 +6,7 @@ module Pod
TEMPLATES_DIR
=
Pathname
.
new
(
File
.
expand_path
(
'../../../../xcode-project-templates'
,
__FILE__
))
# TODO see if we really need different templates for iOS and OS X
def
self
.
static_library
def
self
.
ios_
static_library
new
TEMPLATES_DIR
+
'cocoa-touch-static-library'
end
...
...
@@ -20,6 +20,16 @@ module Pod
'Pods.xcodeproj/project.pbxproj'
end
def
to_hash
@template
end
def
find_object
(
conditions
)
objects
.
find
do
|
_
,
object
|
object
.
objectsForKeys
(
conditions
.
keys
,
notFoundMarker
:Object
.
new
)
==
conditions
.
values
end
end
def
add_source_file
(
file
)
file_ref_uuid
=
add_file_reference
(
file
,
'SOURCE_ROOT'
)
add_file_to_group
(
file_ref_uuid
,
'Pods'
)
...
...
@@ -30,23 +40,7 @@ module Pod
build_file_uuid
=
add_build_file
(
file_ref_uuid
)
add_file_to_list
(
'PBXSourcesBuildPhase'
,
build_file_uuid
)
end
end
def
add_framework
(
path
)
file_ref_uuid
=
add_file_reference
(
path
,
'SDKROOT'
)
add_file_to_group
(
file_ref_uuid
,
'Frameworks'
)
build_file_uuid
=
add_build_file
(
file_ref_uuid
)
add_file_to_list
(
'PBXFrameworksBuildPhase'
,
build_file_uuid
)
end
def
add_header_search_path
(
path
)
objects_by_isa
(
'XCBuildConfiguration'
).
each
do
|
_
,
object
|
(
object
[
'buildSettings'
][
'HEADER_SEARCH_PATHS'
]
||=
[])
<<
path
end
end
def
to_hash
@template
file_ref_uuid
end
def
create_in
(
pods_root
)
...
...
spec/unit/xcode/project_spec.rb
0 → 100644
View file @
d1ba2e80
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
"Pod::Xcode::Project"
do
extend
SpecHelper
::
TemporaryDirectory
before
do
@project
=
Pod
::
Xcode
::
Project
.
ios_static_library
end
it
"returns an instance initialized from the iOS static library template"
do
template_dir
=
Pod
::
Xcode
::
Project
::
TEMPLATES_DIR
+
'cocoa-touch-static-library'
template_file
=
(
template_dir
+
'Pods.xcodeproj/project.pbxproj'
).
to_s
@project
.
to_hash
.
should
==
NSDictionary
.
dictionaryWithContentsOfFile
(
template_file
)
end
it
"adds an `m' or `c' file as a build file and adds it to the `sources build' phase list"
do
build_file_uuids
=
[]
%w{ m mm c cpp }
.
each
do
|
ext
|
path
=
Pathname
.
new
(
"path/to/file.
#{
ext
}
"
)
file_ref_uuid
=
@project
.
add_source_file
(
path
)
@project
.
to_hash
[
'objects'
][
file_ref_uuid
].
should
==
{
'name'
=>
path
.
basename
.
to_s
,
'isa'
=>
'PBXFileReference'
,
'sourceTree'
=>
'SOURCE_ROOT'
,
'path'
=>
path
.
to_s
}
build_file_uuid
,
_
=
@project
.
find_object
({
'isa'
=>
'PBXBuildFile'
,
'fileRef'
=>
file_ref_uuid
})
build_file_uuids
<<
build_file_uuid
_
,
object
=
@project
.
find_object
(
'isa'
=>
'PBXSourcesBuildPhase'
)
object
[
'files'
].
should
==
build_file_uuids
_
,
object
=
@project
.
find_object
(
'isa'
=>
'PBXHeadersBuildPhase'
)
object
[
'files'
].
should
.
not
.
include
build_file_uuid
end
end
it
"adds a `h' file as a build file and adds it to the `headers build' phase list"
do
path
=
Pathname
.
new
(
"path/to/file.h"
)
file_ref_uuid
=
@project
.
add_source_file
(
path
)
@project
.
to_hash
[
'objects'
][
file_ref_uuid
].
should
==
{
'name'
=>
path
.
basename
.
to_s
,
'isa'
=>
'PBXFileReference'
,
'sourceTree'
=>
'SOURCE_ROOT'
,
'path'
=>
path
.
to_s
}
build_file_uuid
,
_
=
@project
.
find_object
({
'isa'
=>
'PBXBuildFile'
,
'fileRef'
=>
file_ref_uuid
})
_
,
object
=
@project
.
find_object
(
'isa'
=>
'PBXHeadersBuildPhase'
)
object
[
'files'
].
should
==
[
build_file_uuid
]
_
,
object
=
@project
.
find_object
(
'isa'
=>
'PBXSourcesBuildPhase'
)
object
[
'files'
].
should
.
not
.
include
build_file_uuid
end
it
"saves the template with the adjusted project"
do
@project
.
create_in
(
temporary_directory
)
(
temporary_directory
+
'Pods-Prefix.pch'
).
should
.
exist
(
temporary_directory
+
'Pods.xcconfig'
).
should
.
exist
project_file
=
(
temporary_directory
+
'Pods.xcodeproj/project.pbxproj'
)
NSDictionary
.
dictionaryWithContentsOfFile
(
project_file
.
to_s
).
should
==
@project
.
to_hash
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