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
dad16075
Commit
dad16075
authored
Nov 24, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Resolver] No need to pass the platform to external sources.
parent
0d387594
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
46 deletions
+84
-46
external_sources.rb
lib/cocoapods/external_sources.rb
+17
-24
resolver.rb
lib/cocoapods/resolver.rb
+7
-7
sandbox.rb
lib/cocoapods/sandbox.rb
+31
-10
external_sources_spec.rb
spec/unit/external_sources_spec.rb
+5
-5
resolver_spec.rb
spec/unit/resolver_spec.rb
+24
-0
No files found.
lib/cocoapods/external_sources.rb
View file @
dad16075
...
...
@@ -68,18 +68,16 @@ module Pod
#
# TODO: rename to specification.
#
def
specification_from_sandbox
(
sandbox
,
platform
)
specification_from_local
(
sandbox
,
platform
)
||
specification_from_external
(
sandbox
,
platform
)
def
specification_from_sandbox
(
sandbox
)
specification_from_local
(
sandbox
)
||
specification_from_external
(
sandbox
)
end
# @return [Specification] returns the specification associated with the
# external source if available in the sandbox.
#
def
specification_from_local
(
sandbox
,
platform
)
if
local_pod
=
sandbox
.
installed_pod_named
(
name
,
platform
)
local_pod
.
top_specification
end
def
specification_from_local
(
sandbox
)
sandbox
.
specification
(
name
)
end
# @return [Specification] returns the specification associated with the
...
...
@@ -88,9 +86,9 @@ module Pod
#
# @raise If not specification could be found.
#
def
specification_from_external
(
sandbox
,
platform
)
copy_external_source_into_sandbox
(
sandbox
,
platform
)
spec
=
specification_from_local
(
sandbox
,
platform
)
def
specification_from_external
(
sandbox
)
copy_external_source_into_sandbox
(
sandbox
)
spec
=
specification_from_local
(
sandbox
)
unless
spec
raise
Informative
,
"No podspec found for `
#{
name
}
' in
#{
description
}
"
end
...
...
@@ -106,12 +104,9 @@ module Pod
# @param [Sandbox] sandbox
# the sandbox where the specification should be stored.
#
# @param [Platform] platform
# TODO this is not needed.
#
# @return [void]
#
def
copy_external_source_into_sandbox
(
sandbox
,
platform
)
def
copy_external_source_into_sandbox
(
sandbox
)
raise
"Abstract method"
end
...
...
@@ -170,16 +165,14 @@ module Pod
# as pre-downloaded indicating to the installer that only clean
# operations are needed.
#
def
copy_external_source_into_sandbox
(
sandbox
,
platform
)
def
copy_external_source_into_sandbox
(
sandbox
)
UI
.
info
(
"->"
.
green
+
" Pre-downloading: '
#{
name
}
'"
)
do
target
=
sandbox
.
root
+
name
target
.
rmtree
if
target
.
exist?
downloader
=
Downloader
.
for_target
(
sandbox
.
root
+
name
,
@params
)
downloader
.
download
store_podspec
(
sandbox
,
target
+
"
#{
name
}
.podspec"
)
if
local_pod
=
sandbox
.
installed_pod_named
(
name
,
platform
)
local_pod
.
downloaded
=
true
end
sandbox
.
predownloaded_pods
<<
name
end
end
...
...
@@ -203,7 +196,7 @@ module Pod
# @see AbstractExternalSource#copy_external_source_into_sandbox
#
def
copy_external_source_into_sandbox
(
sandbox
,
_
)
def
copy_external_source_into_sandbox
(
sandbox
)
UI
.
info
(
"->"
.
green
+
" Fetching podspec for `
#{
name
}
' from:
#{
@params
[
:podspec
]
}
"
)
do
path
=
@params
[
:podspec
]
path
=
Pathname
.
new
(
path
).
expand_path
if
path
.
start_with?
(
"~"
)
...
...
@@ -229,7 +222,7 @@ module Pod
# @see AbstractExternalSource#copy_external_source_into_sandbox
#
def
copy_external_source_into_sandbox
(
sandbox
,
_
)
def
copy_external_source_into_sandbox
(
sandbox
)
store_podspec
(
sandbox
,
pod_spec_path
)
end
...
...
@@ -246,8 +239,8 @@ module Pod
# once installed, the podspec would be updated only by `pod
# update`.
#
def
specification_from_local
(
sandbox
,
platform
)
specification_from_external
(
sandbox
,
platform
)
def
specification_from_local
(
sandbox
)
specification_from_external
(
sandbox
)
end
# @see AbstractExternalSource#specification_from_local
...
...
@@ -255,8 +248,8 @@ module Pod
# @note The LocalSource overrides the source of the specification to
# point to the local path.
#
def
specification_from_external
(
sandbox
,
platform
)
copy_external_source_into_sandbox
(
sandbox
,
platform
)
def
specification_from_external
(
sandbox
)
copy_external_source_into_sandbox
(
sandbox
)
spec
=
Specification
.
from_file
(
pod_spec_path
)
spec
.
source
=
@params
spec
...
...
lib/cocoapods/resolver.rb
View file @
dad16075
...
...
@@ -174,7 +174,7 @@ module Pod
dependency
=
locked_dep
if
locked_dep
UI
.
message
(
"-
#{
dependency
}
"
,
''
,
2
)
do
set
=
find_cached_set
(
dependency
,
target_definition
.
platform
)
set
=
find_cached_set
(
dependency
)
set
.
required_by
(
dependency
,
dependent_spec
.
to_s
)
unless
@loaded_specs
.
include?
(
dependency
.
name
)
...
...
@@ -213,13 +213,13 @@ module Pod
#
# @return [Set] the cached set for a given dependency.
#
def
find_cached_set
(
dependency
,
platform
)
def
find_cached_set
(
dependency
)
name
=
dependency
.
root_name
unless
cached_sets
[
name
]
if
dependency
.
specification
set
=
Specification
::
Set
::
External
.
new
(
dependency
.
specification
)
elsif
dependency
.
external_source
set
=
set_from_external_source
(
dependency
,
platform
)
set
=
set_from_external_source
(
dependency
)
else
set
=
cached_sources
.
search
(
dependency
)
end
...
...
@@ -230,12 +230,12 @@ module Pod
# Returns a new set created from an external source
#
def
set_from_external_source
(
dependency
,
platform
)
def
set_from_external_source
(
dependency
)
source
=
ExternalSources
.
from_dependency
(
dependency
)
spec
=
if
update_external_specs
s
ource
.
specification_from_external
(
@sandbox
,
platform
)
if
update_external_specs
s
pec
=
source
.
specification_from_external
(
sandbox
)
else
s
ource
.
specification_from_sandbox
(
@sandbox
,
platform
)
s
pec
=
source
.
specification_from_sandbox
(
sandbox
)
end
set
=
Specification
::
Set
::
External
.
new
(
spec
)
set
...
...
lib/cocoapods/sandbox.rb
View file @
dad16075
...
...
@@ -40,6 +40,7 @@ module Pod
@public_headers
=
HeadersDirectory
.
new
(
self
,
PUBLIC_HEADERS_DIR
)
@cached_local_pods
=
{}
@cached_locally_sourced_pods
=
{}
@predownloaded_pods
=
[]
FileUtils
.
mkdir_p
(
@root
)
end
...
...
@@ -112,16 +113,6 @@ module Pod
end
end
#--------------------------------------#
# @!group Private methods
attr_accessor
:cached_local_pods
attr_accessor
:cached_locally_sourced_pods
private
# Returns the path of the specification for the Pod with the
# given name.
#
...
...
@@ -134,6 +125,36 @@ module Pod
path
=
root
+
"Local Podspecs/
#{
name
}
.podspec"
path
.
exist?
?
path
:
nil
end
# Returns the specification for the Pod with the given name.
#
# @param [String] name
# the name of the Pod for which the specification is requested.
#
# @return [Specification] the specification.
#
def
specification
(
name
)
if
file
=
podspec_for_name
(
name
)
Specification
.
from_file
(
file
)
end
end
# @return [Array<String>] the names of the pods that have been
# pre-downloaded from an external source.
#
# TODO: the installer needs to be aware of it.
#
attr_reader
:predownloaded_pods
#--------------------------------------#
# @!group Private methods
private
attr_accessor
:cached_local_pods
attr_accessor
:cached_locally_sourced_pods
end
#---------------------------------------------------------------------------#
...
...
spec/unit/external_sources_spec.rb
View file @
dad16075
...
...
@@ -26,7 +26,7 @@ module Pod
it
"creates a copy of the podspec"
do
dependency
=
Dependency
.
new
(
"Reachability"
,
:git
=>
fixture
(
'integration/Reachability'
))
external_source
=
ExternalSources
.
from_dependency
(
dependency
)
external_source
.
copy_external_source_into_sandbox
(
config
.
sandbox
,
Platform
.
ios
)
external_source
.
copy_external_source_into_sandbox
(
config
.
sandbox
)
path
=
config
.
sandbox
.
root
+
'Local Podspecs/Reachability.podspec'
path
.
should
.
exist?
end
...
...
@@ -34,8 +34,8 @@ module Pod
it
"marks a LocalPod as downloaded"
do
dependency
=
Dependency
.
new
(
"Reachability"
,
:git
=>
fixture
(
'integration/Reachability'
))
external_source
=
ExternalSources
.
from_dependency
(
dependency
)
external_source
.
copy_external_source_into_sandbox
(
config
.
sandbox
,
Platform
.
ios
)
config
.
sandbox
.
installed_pod_named
(
'Reachability'
,
Platform
.
ios
).
downloaded
.
should
.
be
.
true
external_source
.
copy_external_source_into_sandbox
(
config
.
sandbox
)
config
.
sandbox
.
predownloaded_pods
.
should
==
[
"Reachability"
]
end
xit
"returns the description"
do
end
...
...
@@ -45,7 +45,7 @@ module Pod
it
"creates a copy of the podspec"
do
dependency
=
Dependency
.
new
(
"Reachability"
,
:podspec
=>
fixture
(
'integration/Reachability/Reachability.podspec'
).
to_s
)
external_source
=
ExternalSources
.
from_dependency
(
dependency
)
external_source
.
copy_external_source_into_sandbox
(
config
.
sandbox
,
Platform
.
ios
)
external_source
.
copy_external_source_into_sandbox
(
config
.
sandbox
)
path
=
config
.
sandbox
.
root
+
'Local Podspecs/Reachability.podspec'
path
.
should
.
exist?
end
...
...
@@ -57,7 +57,7 @@ module Pod
it
"creates a copy of the podspec"
do
dependency
=
Dependency
.
new
(
"Reachability"
,
:local
=>
fixture
(
'integration/Reachability'
))
external_source
=
ExternalSources
.
from_dependency
(
dependency
)
external_source
.
copy_external_source_into_sandbox
(
config
.
sandbox
,
Platform
.
ios
)
external_source
.
copy_external_source_into_sandbox
(
config
.
sandbox
)
path
=
config
.
sandbox
.
root
+
'Local Podspecs/Reachability.podspec'
path
.
should
.
exist?
end
...
...
spec/unit/resolver_spec.rb
View file @
dad16075
...
...
@@ -174,6 +174,30 @@ module Pod
e
.
message
.
should
.
match
(
/already activated version/
)
end
xit
"is robust against infinite loops"
do
end
xit
"takes into account locked dependencies"
do
end
xit
"transfers the head state of a dependency to a specification"
do
end
xit
""
do
end
xit
""
do
end
xit
""
do
end
# describe "Concerning Installation mode" do
# before do
# config.repos_dir = fixture('spec-repos')
...
...
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