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
dc5b15a5
Commit
dc5b15a5
authored
Apr 07, 2012
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make all not-disabled specs green again. Also introduces the `pod install --no-integrate` option.
parent
1db64746
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
70 additions
and
51 deletions
+70
-51
.kick
.kick
+1
-1
TODO
TODO
+1
-0
install.rb
lib/cocoapods/command/install.rb
+20
-16
config.rb
lib/cocoapods/config.rb
+9
-8
installer.rb
lib/cocoapods/installer.rb
+1
-2
user_project_integrator.rb
lib/cocoapods/installer/user_project_integrator.rb
+13
-11
user_project_integrator_spec.rb
spec/functional/user_project_integrator_spec.rb
+16
-11
integration_spec.rb
spec/integration_spec.rb
+3
-0
install_command_spec.rb
spec/unit/command/install_command_spec.rb
+6
-2
No files found.
.kick
View file @
dc5b15a5
...
@@ -6,7 +6,7 @@ process do |files|
...
@@ -6,7 +6,7 @@ process do |files|
specs = files.take_and_map do |file|
specs = files.take_and_map do |file|
if file =~ %r{lib/cocoapods/(.+?)\.rb$}
if file =~ %r{lib/cocoapods/(.+?)\.rb$}
s = Dir.glob("spec/**/#{File.basename(file, '.rb')}_spec.rb")
s = Dir.glob("spec/**/#{File.basename(file, '.rb')}_spec.rb")
if file =~ %r{lib/cocoapods/installer.
+
\.rb$}
if file =~ %r{lib/cocoapods/installer.
*
\.rb$}
s.concat(['spec/unit/installer_spec.rb', 'spec/unit/installer/target_installer_spec.rb'])
s.concat(['spec/unit/installer_spec.rb', 'spec/unit/installer/target_installer_spec.rb'])
end
end
s.uniq unless s.empty?
s.uniq unless s.empty?
...
...
TODO
View file @
dc5b15a5
...
@@ -6,3 +6,4 @@
...
@@ -6,3 +6,4 @@
* Validate that the dependencies in the targets don't conflict. E.g. two different versions of the same pod.
* Validate that the dependencies in the targets don't conflict. E.g. two different versions of the same pod.
* Move Podfile.lock generator from Installer into its own file.
* Move Podfile.lock generator from Installer into its own file.
* Remove better_installer.rb file
* Remove better_installer.rb file
* One or more of the specs are changing the remote URL of the master repo in ~/.cocoapods
lib/cocoapods/command/install.rb
View file @
dc5b15a5
...
@@ -24,18 +24,20 @@ module Pod
...
@@ -24,18 +24,20 @@ module Pod
end
end
def
self
.
options
def
self
.
options
" --no-clean Leave SCM dirs like `.git' and `.svn' intact after downloading
\n
"
+
" --no-clean Leave SCM dirs like `.git' and `.svn' in tact after downloading
\n
"
+
" --no-doc Skip documentation generation with appledoc
\n
"
+
" --no-doc Skip documentation generation with appledoc
\n
"
+
" --force-doc Force the generation of documentation
\n
"
+
" --force-doc Force the generation of documentation
\n
"
+
" --no-update Skip running `pod repo update` before install
\n
"
+
" --no-integrate Skip integration of the Pods libraries in the Xcode project(s)
\n
"
+
" --no-update Skip running `pod repo update` before install
\n
"
+
super
super
end
end
def
initialize
(
argv
)
def
initialize
(
argv
)
config
.
clean
=
!
argv
.
option
(
'--no-clean'
)
config
.
clean
=
!
argv
.
option
(
'--no-clean'
)
config
.
doc
=
!
argv
.
option
(
'--no-doc'
)
config
.
doc
=
!
argv
.
option
(
'--no-doc'
)
config
.
force_doc
=
argv
.
option
(
'--force-doc'
)
config
.
force_doc
=
argv
.
option
(
'--force-doc'
)
@update_repo
=
!
argv
.
option
(
'--no-update'
)
config
.
integrate_targets
=
!
argv
.
option
(
'--no-integrate'
)
@update_repo
=
!
argv
.
option
(
'--no-update'
)
super
unless
argv
.
empty?
super
unless
argv
.
empty?
end
end
...
@@ -44,15 +46,17 @@ module Pod
...
@@ -44,15 +46,17 @@ module Pod
raise
Informative
,
"No `Podfile' found in the current working directory."
raise
Informative
,
"No `Podfile' found in the current working directory."
end
end
# TODO this should be done for all targets (?)
if
config
.
integrate_targets?
if
xcodeproj
=
podfile
.
target_definitions
[
:default
].
xcodeproj
# TODO this should be done for all targets (?)
raise
Informative
,
"Please specify a valid xcodeproj path in your Podfile.
\n\n
"
+
unless
xcodeproj
=
podfile
.
target_definitions
[
:default
].
xcodeproj
"Usage:
\n\t
"
+
raise
Informative
,
"Please specify a valid xcodeproj path in your Podfile.
\n\n
"
+
"xcodeproj 'path/to/project.xcodeproj'"
"Usage:
\n\t
"
+
end
"xcodeproj 'path/to/project.xcodeproj'"
end
if
xcodeproj
&&
!
xcodeproj
.
exist?
if
xcodeproj
&&
!
xcodeproj
.
exist?
raise
Informative
,
"The specified project `
#{
xcodeproj
}
' does not exist."
raise
Informative
,
"The specified project `
#{
xcodeproj
}
' does not exist."
end
end
end
if
@update_repo
if
@update_repo
...
...
lib/cocoapods/config.rb
View file @
dc5b15a5
...
@@ -10,18 +10,19 @@ module Pod
...
@@ -10,18 +10,19 @@ module Pod
@instance
=
instance
@instance
=
instance
end
end
attr_accessor
:repos_dir
,
:project_root
,
:project_pods_root
,
:clean
,
:verbose
,
:silent
,
:doc
,
:doc_install
,
:force_doc
attr_accessor
:repos_dir
,
:project_root
,
:project_pods_root
,
:clean
,
:verbose
,
:silent
,
:doc
,
:doc_install
,
:force_doc
,
:integrate_targets
alias_method
:clean?
,
:clean
alias_method
:clean?
,
:clean
alias_method
:verbose?
,
:verbose
alias_method
:verbose?
,
:verbose
alias_method
:silent?
,
:silent
alias_method
:silent?
,
:silent
alias_method
:doc?
,
:doc
alias_method
:doc?
,
:doc
# TODO rename to generate_docs?
alias_method
:doc_install?
,
:doc_install
alias_method
:doc_install?
,
:doc_install
alias_method
:force_doc?
,
:force_doc
alias_method
:force_doc?
,
:force_doc
alias_method
:integrate_targets?
,
:integrate_targets
def
initialize
def
initialize
@repos_dir
=
Pathname
.
new
(
File
.
expand_path
(
"~/.cocoapods"
))
@repos_dir
=
Pathname
.
new
(
File
.
expand_path
(
"~/.cocoapods"
))
@verbose
=
@silent
=
@force_doc
=
false
@verbose
=
@silent
=
@force_doc
=
false
@clean
=
@doc
=
@doc_install
=
true
@clean
=
@doc
=
@doc_install
=
@integrate_targets
=
true
end
end
def
project_root
def
project_root
...
...
lib/cocoapods/installer.rb
View file @
dc5b15a5
...
@@ -91,8 +91,7 @@ module Pod
...
@@ -91,8 +91,7 @@ module Pod
puts
"* Writing Xcode project file to `
#{
@sandbox
.
project_path
}
'
\n\n
"
if
config
.
verbose?
puts
"* Writing Xcode project file to `
#{
@sandbox
.
project_path
}
'
\n\n
"
if
config
.
verbose?
project
.
save_as
(
@sandbox
.
project_path
)
project
.
save_as
(
@sandbox
.
project_path
)
# The conditional is actually only so we omit the integration when running the specs.
UserProjectIntegrator
.
new
(
@podfile
).
integrate!
if
config
.
integrate_targets?
UserProjectIntegrator
.
new
(
@podfile
).
integrate!
if
@podfile
.
xcodeproj
(
false
)
end
end
def
run_post_install_hooks
def
run_post_install_hooks
...
...
lib/cocoapods/installer/user_project_integrator.rb
View file @
dc5b15a5
...
@@ -85,18 +85,20 @@ module Pod
...
@@ -85,18 +85,20 @@ module Pod
# the Pods lib should be linked with.
# the Pods lib should be linked with.
def
targets
def
targets
@targets
||=
begin
@targets
||=
begin
if
link_with
=
@target_definition
.
link_with
if
link_with
=
@target_definition
.
link_with
user_project
.
targets
.
select
do
|
target
|
# Find explicitly named targets.
link_with
.
include?
target
.
name
user_project
.
targets
.
select
do
|
target
|
end
link_with
.
include?
target
.
name
else
[
user_project
.
targets
.
first
]
end
.
reject
do
|
target
|
# reject any target that already has this Pods library in one of its frameworks build phases
target
.
frameworks_build_phases
.
any?
do
|
phase
|
phase
.
files
.
any?
{
|
file
|
file
.
name
==
@target_definition
.
lib_name
}
end
end
end
else
# Default to the first, which in a simple project is probably an app target.
[
user_project
.
targets
.
first
]
end
.
reject
do
|
target
|
# Reject any target that already has this Pods library in one of its frameworks build phases
target
.
frameworks_build_phases
.
any?
do
|
phase
|
phase
.
files
.
any?
{
|
file
|
file
.
name
==
@target_definition
.
lib_name
}
end
end
end
end
end
end
...
...
spec/functional/user_project_integrator_spec.rb
View file @
dc5b15a5
...
@@ -39,7 +39,7 @@ describe Pod::Installer::UserProjectIntegrator do
...
@@ -39,7 +39,7 @@ describe Pod::Installer::UserProjectIntegrator do
it
'adds the project being integrated to the workspace'
do
it
'adds the project being integrated to the workspace'
do
workspace
=
Xcodeproj
::
Workspace
.
new_from_xcworkspace
(
@sample_project_path
.
dirname
+
"SampleProject.xcworkspace"
)
workspace
=
Xcodeproj
::
Workspace
.
new_from_xcworkspace
(
@sample_project_path
.
dirname
+
"SampleProject.xcworkspace"
)
workspace
.
should
.
include?
(
"SampleProject.xcodeproj"
)
workspace
.
projpaths
.
sort
.
should
==
%w{ Pods/Pods.xcodeproj SampleProject.xcodeproj }
end
end
it
'adds the Pods project to the workspace'
do
it
'adds the Pods project to the workspace'
do
...
@@ -82,22 +82,27 @@ describe Pod::Installer::UserProjectIntegrator do
...
@@ -82,22 +82,27 @@ describe Pod::Installer::UserProjectIntegrator do
end
end
end
end
before
do
# Reset the cached TargetIntegrator#targets lists.
@integrator
.
instance_variable_set
(
:@target_integrators
,
nil
)
end
it
"only tries to integrate Pods libraries into user targets that haven't been integrated yet"
do
it
"only tries to integrate Pods libraries into user targets that haven't been integrated yet"
do
app
,
test_runner
=
@integrator
.
target_integrators
.
first
.
user_project
.
targets
.
to_a
app_integrator
=
@integrator
.
target_integrators
.
find
{
|
t
|
t
.
target_definition
.
name
==
:default
}
p
app
.
frameworks_build_phases
.
first
.
files
test_runner_integrator
=
@integrator
.
target_integrators
.
find
{
|
t
|
t
.
target_definition
.
name
==
:test_runner
}
test_runner
.
frameworks_build_phases
.
first
.
build_files
.
last
.
destroy
#p app, test_runner
# Remove libPods.a from the app target. But don't do it through TargetIntegrator#targets,
# as it will return only those that still need integration.
app_target
=
app_integrator
.
user_project
.
targets
.
where
(
:name
=>
'SampleProject'
)
app_target
.
frameworks_build_phases
.
first
.
build_files
.
last
.
destroy
target_integrators
=
@integrator
.
target_integrators
.
sort_by
{
|
target
|
target
.
target_definition
.
label
}
app_integrator
.
expects
(
:add_pods_library
)
@integrator
.
stubs
(
:target_integrators
).
returns
(
target_integrators
)
test_runner_integrator
.
expects
(
:add_pods_library
).
never
#p target_integrators
target_integrators
.
first
.
expects
(
:add_pods_library
).
never
target_integrators
.
last
.
expects
(
:add_pods_library
)
@integrator
.
integrate!
@integrator
.
integrate!
end
end
x
it
"does not even try to save the project if none of the target integrators had any work to do"
do
it
"does not even try to save the project if none of the target integrators had any work to do"
do
@integrator
.
target_integrators
.
first
.
user_project
.
expects
(
:save_as
).
never
@integrator
.
target_integrators
.
first
.
user_project
.
expects
(
:save_as
).
never
@integrator
.
integrate!
@integrator
.
integrate!
end
end
...
...
spec/integration_spec.rb
View file @
dc5b15a5
...
@@ -37,6 +37,7 @@ else
...
@@ -37,6 +37,7 @@ else
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
project_root
=
temporary_directory
config
.
project_root
=
temporary_directory
config
.
doc_install
=
false
config
.
doc_install
=
false
config
.
integrate_targets
=
false
end
end
before
do
before
do
...
@@ -364,6 +365,8 @@ else
...
@@ -364,6 +365,8 @@ else
end
end
it
"sets up an existing project with pods"
do
it
"sets up an existing project with pods"
do
config
.
integrate_targets
=
true
basename
=
platform
==
:ios
?
'iPhone'
:
'Mac'
basename
=
platform
==
:ios
?
'iPhone'
:
'Mac'
projpath
=
temporary_directory
+
'ASIHTTPRequest.xcodeproj'
projpath
=
temporary_directory
+
'ASIHTTPRequest.xcodeproj'
FileUtils
.
cp_r
(
fixture
(
"integration/ASIHTTPRequest/
#{
basename
}
.xcodeproj"
),
projpath
)
FileUtils
.
cp_r
(
fixture
(
"integration/ASIHTTPRequest/
#{
basename
}
.xcodeproj"
),
projpath
)
...
...
spec/unit/command/install_command_spec.rb
View file @
dc5b15a5
...
@@ -36,12 +36,16 @@ describe "Pod::Command::Install" do
...
@@ -36,12 +36,16 @@ describe "Pod::Command::Install" do
describe
"When the Podfile specifies xcodeproj to an invalid path"
do
describe
"When the Podfile specifies xcodeproj to an invalid path"
do
before
do
before
do
config
.
stubs
(
:podfile
).
returns
(
Pod
::
Podfile
.
new
{
platform
:ios
;
xcodeproj
'nonexistent/project.xcodeproj'
;
dependency
'AFNetworking'
})
config
.
stubs
(
:podfile
).
returns
(
Pod
::
Podfile
.
new
do
platform
:ios
xcodeproj
'nonexistent/project.xcodeproj'
dependency
'AFNetworking'
end
)
@installer
=
Pod
::
Command
::
Install
.
new
(
Pod
::
Command
::
ARGV
.
new
)
@installer
=
Pod
::
Command
::
Install
.
new
(
Pod
::
Command
::
ARGV
.
new
)
end
end
it
"raises an informative error"
do
it
"raises an informative error"
do
should
.
raise
(
Pod
::
Informative
)
{
@installer
.
run
}
should
.
raise
(
Pod
::
Informative
)
{
@installer
.
run
}
end
end
it
"should include an informative message"
do
it
"should include an informative message"
do
...
...
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