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
646a24a2
Commit
646a24a2
authored
Nov 14, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Core Extraction] Adapted Resolver.
parent
b0c910b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
resolver.rb
lib/cocoapods/resolver.rb
+6
-6
resolver_spec.rb
spec/unit/resolver_spec.rb
+5
-5
No files found.
lib/cocoapods/resolver.rb
View file @
646a24a2
...
@@ -53,7 +53,7 @@ module Pod
...
@@ -53,7 +53,7 @@ module Pod
@update_external_specs
=
true
@update_external_specs
=
true
@cached_sets
=
{}
@cached_sets
=
{}
@cached_sources
=
Source
::
Aggregate
.
new
@cached_sources
=
Source
::
Aggregate
.
new
(
config
.
repos_dir
)
end
end
# Identifies the specifications that should be installed according whether
# Identifies the specifications that should be installed according whether
...
@@ -117,11 +117,11 @@ module Pod
...
@@ -117,11 +117,11 @@ module Pod
unless
@pods_to_install
unless
@pods_to_install
if
lockfile
if
lockfile
@pods_to_install
=
specs
.
select
do
|
spec
|
@pods_to_install
=
specs
.
select
do
|
spec
|
spec
.
version
!=
lockfile
.
pods_versions
[
spec
.
pod
_name
]
spec
.
version
!=
lockfile
.
pods_versions
[
spec
.
root_spec
_name
]
end
.
map
(
&
:name
)
end
.
map
(
&
:name
)
if
update_mode
if
update_mode
@pods_to_install
+=
specs
.
select
do
|
spec
|
@pods_to_install
+=
specs
.
select
do
|
spec
|
spec
.
version
.
head?
||
pods_from_external_sources
.
include?
(
spec
.
pod
_name
)
spec
.
version
.
head?
||
pods_from_external_sources
.
include?
(
spec
.
root_spec
_name
)
end
.
map
(
&
:name
)
end
.
map
(
&
:name
)
end
end
@pods_to_install
+=
@pods_by_state
[
:added
]
+
@pods_by_state
[
:changed
]
@pods_to_install
+=
@pods_by_state
[
:added
]
+
@pods_by_state
[
:changed
]
...
@@ -165,7 +165,7 @@ module Pod
...
@@ -165,7 +165,7 @@ module Pod
end
end
set
=
Specification
::
Set
::
External
.
new
(
specification
)
set
=
Specification
::
Set
::
External
.
new
(
specification
)
if
dependency
.
subspec_dependency?
if
dependency
.
subspec_dependency?
@cached_sets
[
dependency
.
top_level
_spec_name
]
||=
set
@cached_sets
[
dependency
.
root
_spec_name
]
||=
set
end
end
set
set
else
else
...
@@ -186,7 +186,7 @@ module Pod
...
@@ -186,7 +186,7 @@ module Pod
dependencies
.
each
do
|
dependency
|
dependencies
.
each
do
|
dependency
|
# Replace the dependency with a more specific one if the pod is already installed.
# Replace the dependency with a more specific one if the pod is already installed.
if
!
update_mode
&&
@pods_to_lock
.
include?
(
dependency
.
name
)
if
!
update_mode
&&
@pods_to_lock
.
include?
(
dependency
.
name
)
dependency
=
lockfile
.
dependency_for_installed_pod_named
(
dependency
.
name
)
dependency
=
lockfile
.
dependency_for_installed_pod_
with_root_
named
(
dependency
.
name
)
end
end
UI
.
message
(
"-
#{
dependency
}
"
,
''
,
2
)
do
UI
.
message
(
"-
#{
dependency
}
"
,
''
,
2
)
do
set
=
find_cached_set
(
dependency
,
target_definition
.
platform
)
set
=
find_cached_set
(
dependency
,
target_definition
.
platform
)
...
@@ -195,7 +195,7 @@ module Pod
...
@@ -195,7 +195,7 @@ module Pod
# Ensure we don't resolve the same spec twice for one target
# Ensure we don't resolve the same spec twice for one target
unless
@loaded_specs
.
include?
(
dependency
.
name
)
unless
@loaded_specs
.
include?
(
dependency
.
name
)
spec
=
set
.
specification_by_name
(
dependency
.
name
)
spec
=
set
.
specification_by_name
(
dependency
.
name
)
@pods_from_external_sources
<<
spec
.
pod
_name
if
dependency
.
external?
@pods_from_external_sources
<<
spec
.
root_spec
_name
if
dependency
.
external?
@loaded_specs
<<
spec
.
name
@loaded_specs
<<
spec
.
name
@cached_specs
[
spec
.
name
]
=
spec
@cached_specs
[
spec
.
name
]
=
spec
# Configure the specification
# Configure the specification
...
...
spec/unit/resolver_spec.rb
View file @
646a24a2
...
@@ -44,13 +44,13 @@ module Pod
...
@@ -44,13 +44,13 @@ module Pod
set
.
stub_platform
=
:ios
set
.
stub_platform
=
:ios
lambda
{
@resolver
.
resolve
}.
should
.
not
.
raise
lambda
{
@resolver
.
resolve
}.
should
.
not
.
raise
set
.
stub_platform
=
:osx
set
.
stub_platform
=
:osx
lambda
{
@resolver
.
resolve
}.
should
.
raise
Informative
lambda
{
@resolver
.
resolve
}.
should
.
raise
Pod
::
StandardError
@podfile
.
platform
:osx
@podfile
.
platform
:osx
set
.
stub_platform
=
:osx
set
.
stub_platform
=
:osx
lambda
{
@resolver
.
resolve
}.
should
.
not
.
raise
lambda
{
@resolver
.
resolve
}.
should
.
not
.
raise
set
.
stub_platform
=
:ios
set
.
stub_platform
=
:ios
lambda
{
@resolver
.
resolve
}.
should
.
raise
Informative
lambda
{
@resolver
.
resolve
}.
should
.
raise
Pod
::
StandardError
end
end
it
"raises once any of the dependencies does not have a deployment_target compatible with its podfile target"
do
it
"raises once any of the dependencies does not have a deployment_target compatible with its podfile target"
do
...
@@ -62,7 +62,7 @@ module Pod
...
@@ -62,7 +62,7 @@ module Pod
lambda
{
@resolver
.
resolve
}.
should
.
not
.
raise
lambda
{
@resolver
.
resolve
}.
should
.
not
.
raise
Specification
.
any_instance
.
stubs
(
:available_platforms
).
returns
([
Platform
.
new
(
:ios
,
'5.0'
),
Platform
.
new
(
:osx
,
'10.7'
)
])
Specification
.
any_instance
.
stubs
(
:available_platforms
).
returns
([
Platform
.
new
(
:ios
,
'5.0'
),
Platform
.
new
(
:osx
,
'10.7'
)
])
lambda
{
@resolver
.
resolve
}.
should
.
raise
Informative
lambda
{
@resolver
.
resolve
}.
should
.
raise
Pod
::
StandardError
end
end
it
"resolves subspecs"
do
it
"resolves subspecs"
do
...
@@ -110,7 +110,7 @@ module Pod
...
@@ -110,7 +110,7 @@ module Pod
}
}
end
end
it
"it includes only the main subspec of a specification node"
do
x
it
"it includes only the main subspec of a specification node"
do
@podfile
=
Podfile
.
new
do
@podfile
=
Podfile
.
new
do
platform
:ios
platform
:ios
pod
do
|
s
|
pod
do
|
s
|
...
@@ -200,7 +200,7 @@ module Pod
...
@@ -200,7 +200,7 @@ module Pod
pod
'JSONKit'
,
"1.5pre"
pod
'JSONKit'
,
"1.5pre"
end
end
resolver
=
Resolver
.
new
(
podfile
,
nil
,
stub
(
'sandbox'
))
resolver
=
Resolver
.
new
(
podfile
,
nil
,
stub
(
'sandbox'
))
lambda
{
resolver
.
resolve
}.
should
.
raise
Informative
lambda
{
resolver
.
resolve
}.
should
.
raise
Pod
::
StandardError
end
end
describe
"Concerning Installation mode"
do
describe
"Concerning Installation mode"
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