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
4fefee1f
Commit
4fefee1f
authored
Oct 12, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create an Xcode project for the platform that’s specified in the Podfile.
parent
6f2f1499
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
79 deletions
+95
-79
TODO
TODO
+0
-1
installer.rb
lib/cocoapods/installer.rb
+1
-1
project.rb
lib/cocoapods/xcode/project.rb
+9
-3
integration_spec.rb
spec/integration_spec.rb
+72
-66
installer_spec.rb
spec/unit/installer_spec.rb
+5
-1
project_spec.rb
spec/unit/xcode/project_spec.rb
+1
-1
project.pbxproj
...lates/cocoa-static-library/Pods.xcodeproj/project.pbxproj
+7
-6
No files found.
TODO
View file @
4fefee1f
* The user *has* to specify the platform of the project in the Podfile.
* Based on the platform setting of the Podfile the appropriate xcode project template should be used.
lib/cocoapods/installer.rb
View file @
4fefee1f
...
...
@@ -43,7 +43,7 @@ module Pod
end
def
xcodeproj
@xcodeproj
||=
Xcode
::
Project
.
ios_static_library
@xcodeproj
||=
Xcode
::
Project
.
static_library
(
@specification
.
platform
)
end
def
generate_project
...
...
lib/cocoapods/xcode/project.rb
View file @
4fefee1f
...
...
@@ -223,9 +223,15 @@ module Pod
file
=
$LOADED_FEATURES
.
find
{
|
file
|
file
=~
%r{cocoapods/xcode/project
\.
rbo?$}
}
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
.
ios_static_library
new
TEMPLATES_DIR
+
'cocoa-touch-static-library'
def
self
.
static_library
(
platform
)
case
platform
when
:osx
new
TEMPLATES_DIR
+
'cocoa-static-library'
when
:ios
new
TEMPLATES_DIR
+
'cocoa-touch-static-library'
else
raise
"No Xcode project template exists for the platform `
#{
platform
.
inspect
}
'"
end
end
def
initialize
(
template_dir
)
...
...
spec/integration_spec.rb
View file @
4fefee1f
...
...
@@ -24,88 +24,94 @@ end
unless
SpecHelper
.
fixture
(
'integration/ASIHTTPRequest/Classes'
).
exist?
puts
"[!] You must run `git submodule update --init` for the integration spec to work, skipping."
else
describe
"A full (integration spec) installation"
do
extend
SpecHelper
::
TemporaryDirectory
before
do
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
fixture
(
'spec-repos/master'
)
# ensure the archive is unpacked
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
project_pods_root
=
temporary_directory
+
'Pods'
FileUtils
.
cp_r
(
fixture
(
'integration/.'
),
config
.
project_pods_root
)
Dir
.
chdir
(
config
.
project_pods_root
.
to_s
)
do
FileUtils
.
mv
(
'ASIHTTPRequest'
,
'ASIHTTPRequest-1.8.1'
)
FileUtils
.
mv
(
'JSONKit'
,
'JSONKit-1.4'
)
FileUtils
.
mv
(
'SSZipArchive'
,
'SSZipArchive-1.0'
)
[
:ios
,
:osx
].
each
do
|
platform
|
describe
"A full (integration spec) installation for platform `
#{
platform
}
'"
do
extend
SpecHelper
::
TemporaryDirectory
before
do
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
fixture
(
'spec-repos/master'
)
# ensure the archive is unpacked
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
project_pods_root
=
temporary_directory
+
'Pods'
FileUtils
.
cp_r
(
fixture
(
'integration/.'
),
config
.
project_pods_root
)
Dir
.
chdir
(
config
.
project_pods_root
.
to_s
)
do
FileUtils
.
mv
(
'ASIHTTPRequest'
,
'ASIHTTPRequest-1.8.1'
)
FileUtils
.
mv
(
'JSONKit'
,
'JSONKit-1.4'
)
FileUtils
.
mv
(
'SSZipArchive'
,
'SSZipArchive-1.0'
)
end
end
end
after
do
config
.
project_pods_root
=
nil
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
end
# TODO add a simple source file which uses the compiled lib to check that it really really works
it
"should activate required pods and create a working static library xcode project"
do
spec
=
Pod
::
Spec
.
new
do
|
s
|
s
.
dependency
'ASIWebPageRequest'
,
'>= 1.8.1'
s
.
dependency
'JSONKit'
,
'>= 1.0'
s
.
dependency
'SSZipArchive'
,
'< 2'
after
do
config
.
project_pods_root
=
nil
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
# TODO add a simple source file which uses the compiled lib to check that it really really works
it
"should activate required pods and create a working static library xcode project"
do
spec
=
Pod
::
File
.
new
do
|
s
|
s
.
platform
=
platform
s
.
dependency
'ASIWebPageRequest'
,
'>= 1.8.1'
s
.
dependency
'JSONKit'
,
'>= 1.0'
s
.
dependency
'SSZipArchive'
,
'< 2'
end
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
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
(
root
+
'Pods.xcconfig'
).
read
.
should
==
installer
.
xcconfig
.
to_s
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
project_file
=
(
root
+
'Pods.xcodeproj/project.pbxproj'
).
to_s
NSDictionary
.
dictionaryWithContentsOfFile
(
project_file
).
should
==
installer
.
xcodeproj
.
to_hash
(
root
+
'Pods.xcconfig'
).
read
.
should
==
installer
.
xcconfig
.
to_s
#puts "\n[!] Compiling static library..."
#Dir.chdir(config.project_pods_root) do
#system("xcodebuild > /dev/null 2>&1").should == true
#system("xcodebuild").should == true
#end
end
project_file
=
(
root
+
'Pods.xcodeproj/project.pbxproj'
).
to_s
NSDictionary
.
dictionaryWithContentsOfFile
(
project_file
).
should
==
installer
.
xcodeproj
.
to_hash
it
"does not activate pods that are only part of other pods"
do
spec
=
Pod
::
Spec
.
new
do
|
s
|
s
.
dependency
'Reachability'
#puts "\n[!] Compiling static library..."
#Dir.chdir(config.project_pods_root) do
#system("xcodebuild > /dev/null 2>&1").should == true
#system("xcodebuild").should == true
#end
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
it
"does not activate pods that are only part of other pods"
do
spec
=
Pod
::
File
.
new
do
|
s
|
s
.
platform
=
platform
s
.
dependency
'Reachability'
end
(
config
.
project_pods_root
+
'Reachability.podspec'
).
should
.
exist
(
config
.
project_pods_root
+
'ASIHTTPRequest.podspec'
).
should
.
not
.
exist
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
# TODO we need to do more cleaning and/or add a --prune task
it
"overwrites an existing project.pbxproj file"
do
spec
=
Pod
::
Spec
.
new
do
|
s
|
s
.
dependency
'JSONKit'
(
config
.
project_pods_root
+
'Reachability.podspec'
).
should
.
exist
(
config
.
project_pods_root
+
'ASIHTTPRequest.podspec'
).
should
.
not
.
exist
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
spec
=
Pod
::
Spec
.
new
do
|
s
|
s
.
dependency
'SSZipArchive'
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
# TODO we need to do more cleaning and/or add a --prune task
it
"overwrites an existing project.pbxproj file"
do
spec
=
Pod
::
File
.
new
do
|
s
|
s
.
platform
=
platform
s
.
dependency
'JSONKit'
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
spec
=
Pod
::
File
.
new
do
|
s
|
s
.
platform
=
platform
s
.
dependency
'SSZipArchive'
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
install!
project
=
Pod
::
Xcode
::
Project
.
new
(
config
.
project_pods_root
)
project
.
source_files
.
sort
.
should
==
Pod
::
Installer
.
new
(
spec
).
source_files
.
sort
project
=
Pod
::
Xcode
::
Project
.
new
(
config
.
project_pods_root
)
project
.
source_files
.
sort
.
should
==
Pod
::
Installer
.
new
(
spec
).
source_files
.
sort
end
end
end
end
spec/unit/installer_spec.rb
View file @
4fefee1f
...
...
@@ -55,7 +55,11 @@ describe "Pod::Installer" do
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
installer
=
Pod
::
Installer
.
new
(
Pod
::
Spec
.
new
{
|
s
|
s
.
dependency
(
name
);
s
.
source_files
=
*
patterns
})
installer
=
Pod
::
Installer
.
new
(
Pod
::
Spec
.
new
do
|
s
|
s
.
platform
=
:ios
s
.
dependency
(
name
)
s
.
source_files
=
*
patterns
end
)
destroot
=
stubbed_destroot
(
installer
)
installer
.
generate_project
...
...
spec/unit/xcode/project_spec.rb
View file @
4fefee1f
...
...
@@ -4,7 +4,7 @@ describe "Pod::Xcode::Project" do
extend
SpecHelper
::
TemporaryDirectory
before
do
@project
=
Pod
::
Xcode
::
Project
.
ios_static_library
@project
=
Pod
::
Xcode
::
Project
.
static_library
(
:ios
)
end
def
find_objects
(
conditions
)
...
...
xcode-project-templates/cocoa-static-library/Pods.xcodeproj/project.pbxproj
View file @
4fefee1f
...
...
@@ -33,7 +33,7 @@
isa
=
PBXGroup
;
children
=
(
518ACD53144605B400F6BE80
/* Pods.xcconfig */
,
518ACD
4414460502
00F6BE80
/* Pods */
,
518ACD
5B1446449B
00F6BE80
/* Pods */
,
518ACD3D1446050200F6BE80
/* Frameworks */
,
518ACD3C1446050200F6BE80
/* Products */
,
);
...
...
@@ -55,20 +55,21 @@
name
=
Frameworks
;
sourceTree
=
"<group>"
;
};
518ACD4
41446050200F6BE80
/* Pod
s */
=
{
518ACD4
51446050200F6BE80
/* Supporting File
s */
=
{
isa
=
PBXGroup
;
children
=
(
518ACD4
51446050200F6BE80
/* Supporting Files
*/
,
518ACD4
61446050200F6BE80
/* Pods-Prefix.pch
*/
,
);
name
=
"Supporting Files"
;
path
=
Pods
;
sourceTree
=
"<group>"
;
};
518ACD
451446050200F6BE80
/* Supporting File
s */
=
{
518ACD
5B1446449B00F6BE80
/* Pod
s */
=
{
isa
=
PBXGroup
;
children
=
(
518ACD4
61446050200F6BE80
/* Pods-Prefix.pch
*/
,
518ACD4
51446050200F6BE80
/* Supporting Files
*/
,
);
name
=
"Supporting Files"
;
name
=
Pods
;
sourceTree
=
"<group>"
;
};
/* End PBXGroup section */
...
...
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