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
8fe92e1e
Commit
8fe92e1e
authored
Sep 21, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Resolver] Lazy repo update.
parent
b8ef7bf5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
98 additions
and
31 deletions
+98
-31
command.rb
lib/cocoapods/command.rb
+0
-8
install.rb
lib/cocoapods/command/install.rb
+1
-2
outdated.rb
lib/cocoapods/command/outdated.rb
+2
-4
update.rb
lib/cocoapods/command/update.rb
+9
-1
config.rb
lib/cocoapods/config.rb
+3
-2
resolver.rb
lib/cocoapods/resolver.rb
+6
-0
integration_spec.rb
spec/integration_spec.rb
+8
-8
config.rb
spec/spec_helper/config.rb
+5
-4
resolver_spec.rb
spec/unit/resolver_spec.rb
+64
-2
No files found.
lib/cocoapods/command.rb
View file @
8fe92e1e
...
@@ -142,14 +142,6 @@ module Pod
...
@@ -142,14 +142,6 @@ module Pod
raise
Informative
,
"No `Podfile.lock' found in the current working directory, run `pod install'."
raise
Informative
,
"No `Podfile.lock' found in the current working directory, run `pod install'."
end
end
end
end
def
update_spec_repos_if_necessary!
if
@update_repo
UI
.
section
'Updating Spec Repositories'
do
Repo
.
new
(
ARGV
.
new
([
"update"
])).
run
end
end
end
end
end
end
end
lib/cocoapods/command/install.rb
View file @
8fe92e1e
...
@@ -35,7 +35,7 @@ module Pod
...
@@ -35,7 +35,7 @@ module Pod
config
.
clean
=
!
argv
.
option
(
'--no-clean'
)
config
.
clean
=
!
argv
.
option
(
'--no-clean'
)
config
.
generate_docs
=
!
argv
.
option
(
'--no-doc'
)
config
.
generate_docs
=
!
argv
.
option
(
'--no-doc'
)
config
.
integrate_targets
=
!
argv
.
option
(
'--no-integrate'
)
config
.
integrate_targets
=
!
argv
.
option
(
'--no-integrate'
)
@update_repo
=
!
argv
.
option
(
'--no-update'
)
config
.
skip_repo_update
=
!
argv
.
option
(
'--no-update'
)
super
unless
argv
.
empty?
super
unless
argv
.
empty?
end
end
...
@@ -48,7 +48,6 @@ module Pod
...
@@ -48,7 +48,6 @@ module Pod
def
run
def
run
verify_podfile_exists!
verify_podfile_exists!
update_spec_repos_if_necessary!
run_install_with_update
(
false
)
run_install_with_update
(
false
)
end
end
end
end
...
...
lib/cocoapods/command/outdated.rb
View file @
8fe92e1e
...
@@ -11,13 +11,11 @@ module Pod
...
@@ -11,13 +11,11 @@ module Pod
end
end
def
self
.
options
def
self
.
options
[
[[
"--no-update"
,
"Skip running `pod repo update` before install"
]].
concat
(
super
)
[
"--no-update"
,
"Skip running `pod repo update` before install"
],
].
concat
(
super
)
end
end
def
initialize
(
argv
)
def
initialize
(
argv
)
@update_repo
=
!
argv
.
option
(
'--no-update'
)
config
.
skip_repo_update
=
argv
.
option
(
'--no-update'
)
super
unless
argv
.
empty?
super
unless
argv
.
empty?
end
end
...
...
lib/cocoapods/command/update.rb
View file @
8fe92e1e
...
@@ -9,10 +9,18 @@ module Pod
...
@@ -9,10 +9,18 @@ module Pod
Updates all dependencies.}
Updates all dependencies.}
end
end
def
self
.
options
[[
"--no-update"
,
"Skip running `pod repo update` before install"
]].
concat
(
super
)
end
def
initialize
(
argv
)
config
.
skip_repo_update
=
argv
.
option
(
'--no-update'
)
super
unless
argv
.
empty?
end
def
run
def
run
verify_podfile_exists!
verify_podfile_exists!
verify_lockfile_exists!
verify_lockfile_exists!
update_spec_repos_if_necessary!
run_install_with_update
(
true
)
run_install_with_update
(
true
)
end
end
end
end
...
...
lib/cocoapods/config.rb
View file @
8fe92e1e
...
@@ -14,7 +14,7 @@ module Pod
...
@@ -14,7 +14,7 @@ module Pod
attr_accessor
:clean
,
:verbose
,
:silent
attr_accessor
:clean
,
:verbose
,
:silent
attr_accessor
:generate_docs
,
:doc_install
attr_accessor
:generate_docs
,
:doc_install
attr_accessor
:integrate_targets
attr_accessor
:integrate_targets
attr_accessor
:new_version_message
attr_accessor
:new_version_message
,
:skip_repo_update
alias_method
:clean?
,
:clean
alias_method
:clean?
,
:clean
alias_method
:verbose?
,
:verbose
alias_method
:verbose?
,
:verbose
...
@@ -22,11 +22,12 @@ module Pod
...
@@ -22,11 +22,12 @@ module Pod
alias_method
:generate_docs?
,
:generate_docs
alias_method
:generate_docs?
,
:generate_docs
alias_method
:doc_install?
,
:doc_install
alias_method
:doc_install?
,
:doc_install
alias_method
:integrate_targets?
,
:integrate_targets
alias_method
:integrate_targets?
,
:integrate_targets
alias_method
:skip_repo_update?
,
:skip_repo_update
alias_method
:new_version_message?
,
:new_version_message
alias_method
:new_version_message?
,
:new_version_message
def
initialize
def
initialize
@repos_dir
=
Pathname
.
new
(
File
.
expand_path
(
"~/.cocoapods"
))
@repos_dir
=
Pathname
.
new
(
File
.
expand_path
(
"~/.cocoapods"
))
@verbose
=
@silent
=
false
@verbose
=
@silent
=
@skip_repo_update
=
false
@clean
=
@generate_docs
=
@doc_install
=
@integrate_targets
=
@new_version_message
=
true
@clean
=
@generate_docs
=
@doc_install
=
@integrate_targets
=
@new_version_message
=
true
end
end
...
...
lib/cocoapods/resolver.rb
View file @
8fe92e1e
...
@@ -80,6 +80,12 @@ module Pod
...
@@ -80,6 +80,12 @@ module Pod
@pods_to_lock
=
(
lockfile
.
pods_names
-
@pods_by_state
[
:added
]
-
@pods_by_state
[
:changed
]
-
@pods_by_state
[
:removed
]).
uniq
@pods_to_lock
=
(
lockfile
.
pods_names
-
@pods_by_state
[
:added
]
-
@pods_by_state
[
:changed
]
-
@pods_by_state
[
:removed
]).
uniq
end
end
unless
config
.
skip_repo_update?
UI
.
section
'Updating Spec Repositories'
do
Command
::
Repo
.
new
(
Command
::
ARGV
.
new
([
"update"
])).
run
end
if
!
@pods_by_state
||
!
(
@pods_by_state
[
:added
]
+
@pods_by_state
[
:changed
]).
empty?
||
update_mode
end
@podfile
.
target_definitions
.
values
.
each
do
|
target_definition
|
@podfile
.
target_definitions
.
values
.
each
do
|
target_definition
|
UI
.
section
"Resolving dependencies for target `
#{
target_definition
.
name
}
' (
#{
target_definition
.
platform
}
):"
do
UI
.
section
"Resolving dependencies for target `
#{
target_definition
.
name
}
' (
#{
target_definition
.
platform
}
):"
do
@loaded_specs
=
[]
@loaded_specs
=
[]
...
...
spec/integration_spec.rb
View file @
8fe92e1e
...
@@ -27,9 +27,9 @@ else
...
@@ -27,9 +27,9 @@ else
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryDirectory
def
create_config!
def
create_config!
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
project_root
=
temporary_directory
config
.
project_root
=
temporary_directory
config
.
integrate_targets
=
false
config
.
integrate_targets
=
false
end
end
before
do
before
do
...
@@ -208,7 +208,6 @@ else
...
@@ -208,7 +208,6 @@ else
result
[
'DEPENDENCIES'
].
should
==
[
"ASIHTTPRequest"
,
"JSONKit (= 1.4)"
]
result
[
'DEPENDENCIES'
].
should
==
[
"ASIHTTPRequest"
,
"JSONKit (= 1.4)"
]
# TODO might be nicer looking to not show the dependencies of the top level spec for each subspec (Reachability).
# TODO might be nicer looking to not show the dependencies of the top level spec for each subspec (Reachability).
should_xcodebuild
(
podfile
.
target_definitions
[
:ios_target
])
should_xcodebuild
(
podfile
.
target_definitions
[
:osx_target
])
should_xcodebuild
(
podfile
.
target_definitions
[
:osx_target
])
end
end
...
@@ -217,10 +216,11 @@ else
...
@@ -217,10 +216,11 @@ else
::
Pod
::
Config
.
instance
=
nil
::
Pod
::
Config
.
instance
=
nil
::
Pod
::
Config
.
instance
.
tap
do
|
c
|
::
Pod
::
Config
.
instance
.
tap
do
|
c
|
ENV
[
'VERBOSE_SPECS'
]
?
c
.
verbose
=
true
:
c
.
silent
=
true
ENV
[
'VERBOSE_SPECS'
]
?
c
.
verbose
=
true
:
c
.
silent
=
true
c
.
doc_install
=
false
c
.
doc_install
=
false
c
.
repos_dir
=
fixture
(
'spec-repos'
)
c
.
repos_dir
=
fixture
(
'spec-repos'
)
c
.
project_root
=
temporary_directory
c
.
project_root
=
temporary_directory
c
.
integrate_targets
=
false
c
.
integrate_targets
=
false
c
.
skip_repo_update
=
true
end
end
Pod
::
Generator
::
Documentation
.
any_instance
.
stubs
(
:already_installed?
).
returns
(
false
)
Pod
::
Generator
::
Documentation
.
any_instance
.
stubs
(
:already_installed?
).
returns
(
false
)
...
...
spec/spec_helper/config.rb
View file @
8fe92e1e
...
@@ -8,10 +8,11 @@ module Bacon
...
@@ -8,10 +8,11 @@ module Bacon
::
Pod
::
Config
.
instance
=
nil
::
Pod
::
Config
.
instance
=
nil
::
Pod
::
Config
.
instance
.
tap
do
|
c
|
::
Pod
::
Config
.
instance
.
tap
do
|
c
|
ENV
[
'VERBOSE_SPECS'
]
?
c
.
verbose
=
true
:
c
.
silent
=
true
ENV
[
'VERBOSE_SPECS'
]
?
c
.
verbose
=
true
:
c
.
silent
=
true
c
.
repos_dir
=
SpecHelper
.
tmp_repos_path
c
.
repos_dir
=
SpecHelper
.
tmp_repos_path
c
.
project_root
=
SpecHelper
.
temporary_directory
c
.
project_root
=
SpecHelper
.
temporary_directory
c
.
doc_install
=
false
c
.
doc_install
=
false
c
.
generate_docs
=
false
c
.
generate_docs
=
false
c
.
skip_repo_update
=
true
end
end
old_run_requirement
.
bind
(
self
).
call
(
description
,
spec
)
old_run_requirement
.
bind
(
self
).
call
(
description
,
spec
)
end
end
...
...
spec/unit/resolver_spec.rb
View file @
8fe92e1e
...
@@ -4,7 +4,6 @@ module Pod
...
@@ -4,7 +4,6 @@ module Pod
describe
Resolver
do
describe
Resolver
do
before
do
before
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
repos_dir
=
fixture
(
'spec-repos'
)
@podfile
=
Podfile
.
new
do
@podfile
=
Podfile
.
new
do
platform
:ios
platform
:ios
pod
'BlocksKit'
pod
'BlocksKit'
...
@@ -261,7 +260,7 @@ module Pod
...
@@ -261,7 +260,7 @@ module Pod
platform
:ios
platform
:ios
pod
'JSONKit'
pod
'JSONKit'
pod
'BlocksKit'
pod
'BlocksKit'
pod
'libPusher'
pod
'libPusher'
# New pod
end
end
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
installed
=
@resolver
.
resolve
.
values
.
flatten
.
map
(
&
:to_s
)
installed
=
@resolver
.
resolve
.
values
.
flatten
.
map
(
&
:to_s
)
...
@@ -294,6 +293,56 @@ module Pod
...
@@ -294,6 +293,56 @@ module Pod
@resolver
.
resolve
@resolver
.
resolve
@resolver
.
should_install?
(
"JSONKit"
).
should
.
be
.
false
@resolver
.
should_install?
(
"JSONKit"
).
should
.
be
.
false
end
end
it
"doesn't updates the repos if there no change in the pods"
do
podfile
=
Podfile
.
new
do
platform
:ios
pod
'BlocksKit'
pod
'JSONKit'
end
config
.
skip_repo_update
=
false
Pod
::
Command
::
Repo
.
any_instance
.
expects
(
:run
).
never
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
resolve
end
it
"updates the repos if there is a new pod"
do
podfile
=
Podfile
.
new
do
platform
:ios
pod
'BlocksKit'
pod
'JSONKit'
pod
'libPusher'
# New pod
end
config
.
skip_repo_update
=
false
Pod
::
Command
::
Repo
.
any_instance
.
expects
(
:run
).
once
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
resolve
end
it
"doesn't update the repos if config indicate to skip it in any case"
do
podfile
=
Podfile
.
new
do
platform
:ios
pod
'BlocksKit'
pod
'JSONKit'
,
:head
#changed to head
pod
'libPusher'
# New pod
end
config
.
skip_repo_update
=
true
Pod
::
Command
::
Repo
.
any_instance
.
expects
(
:run
).
never
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
resolve
end
it
"updates the repos if there is a new pod"
do
podfile
=
Podfile
.
new
do
platform
:ios
pod
'BlocksKit'
pod
'JSONKit'
,
:head
#changed to head
end
config
.
skip_repo_update
=
false
Pod
::
Command
::
Repo
.
any_instance
.
expects
(
:run
).
once
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
resolve
end
end
end
describe
"Concerning Update mode"
do
describe
"Concerning Update mode"
do
...
@@ -356,6 +405,19 @@ module Pod
...
@@ -356,6 +405,19 @@ module Pod
@resolver
.
should_install?
(
"libPusher"
).
should
.
be
.
true
@resolver
.
should_install?
(
"libPusher"
).
should
.
be
.
true
end
end
it
"always updates the repos even if there is change in the pods"
do
podfile
=
Podfile
.
new
do
platform
:ios
pod
'JSONKit'
pod
'libPusher'
end
config
.
skip_repo_update
=
false
Pod
::
Command
::
Repo
.
any_instance
.
expects
(
:run
).
once
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
update_mode
=
true
@resolver
.
resolve
end
# TODO: stub the specification resolution for the sandbox
# TODO: stub the specification resolution for the sandbox
xit
"it always suggests to update pods from external sources"
do
xit
"it always suggests to update pods from external sources"
do
podfile
=
Podfile
.
new
do
podfile
=
Podfile
.
new
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