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
b27e1d2c
Commit
b27e1d2c
authored
Sep 16, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish installer and integration specs.
parent
3655f6e5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
13 deletions
+58
-13
installer.rb
lib/cocoa_pods/installer.rb
+1
-1
project.rb
lib/cocoa_pods/xcode/project.rb
+15
-2
integration_spec.rb
spec/integration_spec.rb
+11
-5
installer_spec.rb
spec/unit/installer_spec.rb
+25
-5
project_spec.rb
spec/unit/xcode/project_spec.rb
+6
-0
No files found.
lib/cocoa_pods/installer.rb
View file @
b27e1d2c
...
...
@@ -71,7 +71,7 @@ module Pod
end
def
write_files!
xproj
.
create_in
(
config
.
project_pods_root
)
x
code
proj
.
create_in
(
config
.
project_pods_root
)
xcconfig
.
create_in
(
config
.
project_pods_root
)
end
end
...
...
lib/cocoa_pods/xcode/project.rb
View file @
b27e1d2c
...
...
@@ -24,12 +24,25 @@ module Pod
@template
end
def
find_object
(
conditions
)
objects
.
find
do
|
_
,
object
|
def
find_object
s
(
conditions
)
objects
.
select
do
|
_
,
object
|
object
.
objectsForKeys
(
conditions
.
keys
,
notFoundMarker
:Object
.
new
)
==
conditions
.
values
end
end
def
find_object
(
conditions
)
find_objects
(
conditions
).
first
end
def
source_files
conditions
=
{
'isa'
=>
'PBXFileReference'
,
'sourceTree'
=>
'SOURCE_ROOT'
}
find_objects
(
conditions
).
map
do
|
_
,
object
|
if
%w{ .h .m .mm .c .cpp }
.
include?
(
File
.
extname
(
object
[
'path'
]))
Pathname
.
new
(
object
[
'path'
])
end
end
.
compact
end
def
add_source_file
(
file
)
file_ref_uuid
=
add_file_reference
(
file
,
'SOURCE_ROOT'
)
add_file_to_group
(
file_ref_uuid
,
'Pods'
)
...
...
spec/integration_spec.rb
View file @
b27e1d2c
...
...
@@ -50,11 +50,17 @@ else
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
(
config
.
project_pods_root
+
'Reachability.podspec'
).
should
.
exist
(
config
.
project_pods_root
+
'ASIHTTPRequest.podspec'
).
should
.
exist
(
config
.
project_pods_root
+
'ASIWebPageRequest.podspec'
).
should
.
exist
(
config
.
project_pods_root
+
'JSONKit.podspec'
).
should
.
exist
(
config
.
project_pods_root
+
'SSZipArchive.podspec'
).
should
.
exist
root
=
config
.
project_pods_root
(
root
+
'Reachability.podspec'
).
should
.
exist
(
root
+
'ASIHTTPRequest.podspec'
).
should
.
exist
(
root
+
'ASIWebPageRequest.podspec'
).
should
.
exist
(
root
+
'JSONKit.podspec'
).
should
.
exist
(
root
+
'SSZipArchive.podspec'
).
should
.
exist
(
root
+
'Pods.xcconfig'
).
read
.
should
==
installer
.
xcconfig
.
to_s
project_file
=
(
root
+
'Pods.xcodeproj/project.pbxproj'
).
to_s
NSDictionary
.
dictionaryWithContentsOfFile
(
project_file
).
should
==
installer
.
xcodeproj
.
to_hash
puts
"
\n
[!] Compiling static library..."
Dir
.
chdir
(
config
.
project_pods_root
)
do
...
...
spec/unit/installer_spec.rb
View file @
b27e1d2c
...
...
@@ -17,28 +17,48 @@ describe "Pod::Installer" do
[
'ASIHTTPRequest'
,
[
'Classes'
],
"{Classes,External/Reachability}/*.{h,m}"
"{Classes,External/Reachability}/*.{h,m}"
,
{
"USER_HEADER_SEARCH_PATHS"
=>
"$(BUILT_PRODUCTS_DIR)"
,
"ALWAYS_SEARCH_USER_PATHS"
=>
"YES"
,
"OTHER_LDFLAGS"
=>
"-framework SystemConfiguration -framework CFNetwork "
\
"-framework MobileCoreServices -l z.1.2.3"
}
],
[
'Reachability'
,
[
"External/Reachability/*.h"
,
"External/Reachability/*.m"
],
"External/Reachability/*.{h,m}"
"External/Reachability/*.{h,m}"
,
{
"USER_HEADER_SEARCH_PATHS"
=>
"$(BUILT_PRODUCTS_DIR)"
,
"ALWAYS_SEARCH_USER_PATHS"
=>
"YES"
}
],
[
'ASIWebPageRequest'
,
[
'**/ASIWebPageRequest.*'
],
"{Classes,Classes/ASIWebPageRequest,External/Reachability}/*.{h,m}"
"{Classes,Classes/ASIWebPageRequest,External/Reachability}/*.{h,m}"
,
{
"USER_HEADER_SEARCH_PATHS"
=>
"$(BUILT_PRODUCTS_DIR)"
,
"ALWAYS_SEARCH_USER_PATHS"
=>
"YES"
,
"HEADER_SEARCH_PATHS"
=>
"$(SDKROOT)/usr/include/libxml2"
,
"OTHER_LDFLAGS"
=>
"-l xml2.2.7.3 -framework SystemConfiguration "
\
"-framework CFNetwork -framework MobileCoreServices -l z.1.2.3"
}
],
].
each
do
|
name
,
patterns
,
expected_pattern
|
].
each
do
|
name
,
patterns
,
expected_pattern
,
xcconfig
|
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
installer
=
Pod
::
Installer
.
new
(
Pod
::
Spec
.
new
{
dependency
(
name
);
source_files
(
*
patterns
)
})
expected
=
(
stubbed_destroot
(
installer
)
+
expected_pattern
).
glob
.
map
do
|
file
|
file
.
relative_path_from
(
config
.
project_pods_root
)
end
installer
.
generate_project
installer
.
source_files
.
size
.
should
==
expected
.
size
installer
.
source_files
.
sort
.
should
==
expected
.
sort
#installer.xproj.source_files.sort.should == expected.sort
installer
.
xcodeproj
.
source_files
.
size
.
should
==
expected
.
size
installer
.
xcodeproj
.
source_files
.
sort
.
should
==
expected
.
sort
installer
.
xcconfig
.
to_hash
.
should
==
xcconfig
end
end
...
...
spec/unit/xcode/project_spec.rb
View file @
b27e1d2c
...
...
@@ -66,4 +66,10 @@ describe "Pod::Xcode::Project" do
project_file
=
(
temporary_directory
+
'Pods.xcodeproj/project.pbxproj'
)
NSDictionary
.
dictionaryWithContentsOfFile
(
project_file
.
to_s
).
should
==
@project
.
to_hash
end
it
"returns all source files"
do
files
=
[
Pathname
.
new
(
'/some/file.h'
),
Pathname
.
new
(
'/some/file.m'
)]
files
.
each
{
|
file
|
@project
.
add_source_file
(
file
)
}
@project
.
source_files
.
sort
.
should
==
files
.
sort
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