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
b09ccf1a
Commit
b09ccf1a
authored
Aug 13, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Install/Update] Minor cleanup.
parent
ae569fc3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
61 deletions
+32
-61
installer.rb
lib/cocoapods/installer.rb
+13
-11
lockfile.rb
lib/cocoapods/lockfile.rb
+3
-12
resolver.rb
lib/cocoapods/resolver.rb
+14
-15
specification.rb
lib/cocoapods/specification.rb
+1
-1
lockfile_spec.rb
spec/unit/lockfile_spec.rb
+0
-22
resolver_spec.rb
spec/unit/resolver_spec.rb
+1
-0
No files found.
lib/cocoapods/installer.rb
View file @
b09ccf1a
...
@@ -37,8 +37,9 @@ module Pod
...
@@ -37,8 +37,9 @@ module Pod
end
.
compact
end
.
compact
end
end
# Install the pods. If the resolver wants the installation of pod it is done
# Install the Pods. If the resolver indicated that a Pod should be installed
# even if it exits. In any case if the pod doesn't exits it is installed.
# and it exits, it is removed an then reinstalled. In any case if the Pod
# doesn't exits it is installed.
#
#
# @return [void]
# @return [void]
#
#
...
@@ -149,7 +150,7 @@ module Pod
...
@@ -149,7 +150,7 @@ module Pod
# we loop over target installers instead of pods, because we yield the target installer
# we loop over target installers instead of pods, because we yield the target installer
# to the spec post install hook.
# to the spec post install hook.
target_installers
.
each
do
|
target_installer
|
target_installers
.
each
do
|
target_installer
|
@
specs_by_target
[
target_installer
.
target_definition
].
each
do
|
spec
|
specs_by_target
[
target_installer
.
target_definition
].
each
do
|
spec
|
spec
.
post_install
(
target_installer
)
spec
.
post_install
(
target_installer
)
end
end
end
end
...
@@ -170,6 +171,15 @@ module Pod
...
@@ -170,6 +171,15 @@ module Pod
target_installer
.
target
.
source_build_phases
.
first
<<
project_file
target_installer
.
target
.
source_build_phases
.
first
<<
project_file
end
end
def
specs_by_target
@specs_by_target
||=
@resolver
.
resolve
end
# @return [Array<Specification>] All dependencies that have been resolved.
def
specifications
specs_by_target
.
values
.
flatten
end
# @return [Array<LocalPod>] A list of LocalPod instances for each
# @return [Array<LocalPod>] A list of LocalPod instances for each
# dependency that is not a download-only one.
# dependency that is not a download-only one.
def
pods
def
pods
...
@@ -188,14 +198,6 @@ module Pod
...
@@ -188,14 +198,6 @@ module Pod
result
result
end
end
def
specifications
specs_by_target
.
values
.
flatten
end
def
specs_by_target
@specs_by_target
||=
@resolver
.
resolve
end
private
private
def
print_title
(
title
,
only_verbose
=
true
)
def
print_title
(
title
,
only_verbose
=
true
)
...
...
lib/cocoapods/lockfile.rb
View file @
b09ccf1a
...
@@ -27,19 +27,9 @@ module Pod
...
@@ -27,19 +27,9 @@ module Pod
#
#
attr_reader
:to_hash
attr_reader
:to_hash
# @param [Pathname] the path of the Lockfile.
# @param [Hash] hash A Hash representation of a Lockfile.
# If no other value is provided the Lockfile is read from this path.
# @param [Podfile] the Podfile to use for generating the Lockfile.
# @param [specs] the specs installed.
#
#
def
initialize
(
hash
)
def
initialize
(
hash
)
if
Version
.
new
(
hash
[
"COCOAPODS"
])
<=
Version
.
new
(
"0.11"
)
# Convert old format to be compatible
# - Pods:
# - libPusher (1.0) [HEAD] -> libPusher (HEAD from 1.0)
# - Dependencies:
# - libPusher [HEAD] -> libPusher (HEAD)
end
@to_hash
=
hash
@to_hash
=
hash
end
end
...
@@ -217,7 +207,8 @@ module Pod
...
@@ -217,7 +207,8 @@ module Pod
to_hash
.
to_yaml
.
gsub
(
/^--- ?\n/
,
""
).
gsub
(
/^([A-Z])/
,
"
\n\\
1"
)
to_hash
.
to_yaml
.
gsub
(
/^--- ?\n/
,
""
).
gsub
(
/^([A-Z])/
,
"
\n\\
1"
)
end
end
# @return [Dictionary] The Dictionary representation of the Lockfile.
# @return [Hash] The Hash representation of the Lockfile generated from
# a given Podfile and the list of resolved Specifications.
#
#
def
self
.
generate_hash_from_podfile
(
podfile
,
specs
)
def
self
.
generate_hash_from_podfile
(
podfile
,
specs
)
hash
=
{}
hash
=
{}
...
...
lib/cocoapods/resolver.rb
View file @
b09ccf1a
...
@@ -22,17 +22,17 @@ module Pod
...
@@ -22,17 +22,17 @@ module Pod
#
#
attr_reader
:lockfile
attr_reader
:lockfile
# @return [
Lockfile
] The Sandbox used by the resolver to find external
# @return [
Sandbox
] The Sandbox used by the resolver to find external
# dependencies.
# dependencies.
#
#
attr_reader
:sandbox
attr_reader
:sandbox
# @return [Array<Strings>] The name of the pods
coming from
an
# @return [Array<Strings>] The name of the pods
that have
an
# external source
s
# external source
.
#
#
attr_reader
:pods_from_external_sources
attr_reader
:pods_from_external_sources
# @return [Array<Set>]
The set
used to resolve the dependencies.
# @return [Array<Set>]
A cache of the sets
used to resolve the dependencies.
#
#
attr_reader
:cached_sets
attr_reader
:cached_sets
...
@@ -50,15 +50,10 @@ module Pod
...
@@ -50,15 +50,10 @@ module Pod
@podfile
=
podfile
@podfile
=
podfile
@lockfile
=
lockfile
@lockfile
=
lockfile
@sandbox
=
sandbox
@sandbox
=
sandbox
@update_external_specs
=
true
@update_external_specs
=
true
@cached_sets
=
{}
@cached_sets
=
{}
@cached_sources
=
Source
::
Aggregate
.
new
@cached_sources
=
Source
::
Aggregate
.
new
@cached_specs
=
{}
@specs_by_target
=
{}
@pods_from_external_sources
=
[]
@dependencies_podfile_incompatible
=
[]
@log_indent
=
0
;
end
end
# Identifies the specifications that should be installed according whether
# Identifies the specifications that should be installed according whether
...
@@ -67,6 +62,11 @@ module Pod
...
@@ -67,6 +62,11 @@ module Pod
# @return [Hash{Podfile::TargetDefinition => Array<Specification>}] specs_by_target
# @return [Hash{Podfile::TargetDefinition => Array<Specification>}] specs_by_target
#
#
def
resolve
def
resolve
@cached_specs
=
{}
@specs_by_target
=
{}
@pods_from_external_sources
=
[]
@log_indent
=
0
;
if
@lockfile
if
@lockfile
puts
"
\n
Finding added, modified or removed dependencies:"
.
green
if
config
.
verbose?
puts
"
\n
Finding added, modified or removed dependencies:"
.
green
if
config
.
verbose?
@pods_by_state
=
@lockfile
.
detect_changes_with_podfile
(
podfile
)
@pods_by_state
=
@lockfile
.
detect_changes_with_podfile
(
podfile
)
...
@@ -137,8 +137,8 @@ module Pod
...
@@ -137,8 +137,8 @@ module Pod
end
end
# @return [Array<Strings>] The name of the pods that were installed
# @return [Array<Strings>] The name of the pods that were installed
# but don't have any dependency anymore.
It returns the nam
e
# but don't have any dependency anymore.
The name of the Pods ar
e
#
of the Pod
stripped from subspecs.
# stripped from subspecs.
#
#
def
removed_pods
def
removed_pods
return
[]
unless
lockfile
return
[]
unless
lockfile
...
@@ -152,8 +152,7 @@ module Pod
...
@@ -152,8 +152,7 @@ module Pod
private
private
# Locks the version of the previously installed pods if they are still
# Locks the given Pods to the version stored in the Lockfile.
# compatible and were required by the Podfile.
#
#
# @return [void]
# @return [void]
#
#
...
@@ -221,8 +220,8 @@ module Pod
...
@@ -221,8 +220,8 @@ module Pod
spec
.
version
.
head
=
dependency
.
head?
spec
.
version
.
head
=
dependency
.
head?
# And recursively load the dependencies of the spec.
# And recursively load the dependencies of the spec.
find_dependency_specs
(
spec
,
spec
.
dependencies
,
target_definition
)
if
spec
.
dependencies
find_dependency_specs
(
spec
,
spec
.
dependencies
,
target_definition
)
if
spec
.
dependencies
validate_platform
(
spec
||
@cached_specs
[
dependency
.
name
],
target_definition
)
end
end
validate_platform
(
spec
||
@cached_specs
[
dependency
.
name
],
target_definition
)
end
end
@log_indent
-=
1
@log_indent
-=
1
end
end
...
...
lib/cocoapods/specification.rb
View file @
b09ccf1a
...
@@ -447,7 +447,7 @@ module Pod
...
@@ -447,7 +447,7 @@ module Pod
end
end
def
to_s
def
to_s
version
?
"
#{
name
}
(
#{
version
}
)"
:
name
"
#{
name
}
(
#{
version
}
)"
end
end
def
inspect
def
inspect
...
...
spec/unit/lockfile_spec.rb
View file @
b09ccf1a
...
@@ -164,28 +164,6 @@ COCOAPODS: 0.11.1
...
@@ -164,28 +164,6 @@ COCOAPODS: 0.11.1
lockfile
=
Pod
::
Lockfile
.
from_file
(
temporary_directory
+
'Podfile.lock_not_existing'
)
lockfile
=
Pod
::
Lockfile
.
from_file
(
temporary_directory
+
'Podfile.lock_not_existing'
)
lockfile
.
should
==
nil
lockfile
.
should
==
nil
end
end
xit
"updates files generated by old versions of CocoaPods"
do
tmp_path
=
temporary_directory
+
'Podfile.lock'
text
=
<<-
LOCKFILE
.
strip_heredoc
PODS:
- BananaLib (1.0) [HEAD]:
- monkey (< 1.0.9, ~> 1.0.1)
- monkey (1.0.8)
DEPENDENCIES:
- BananaLib (HEAD)
LOCKFILE
File
.
open
(
tmp_path
,
'w'
)
{
|
f
|
f
.
write
(
text
)
}
lockfile
=
Pod
::
Lockfile
.
from_file
(
tmp_path
)
lockfile
.
to_hash
.
should
==
{
"PODS"
=>
[
{
"BananaLib (HEAD from 1.0)"
=>
[
"monkey (< 1.0.9, ~> 1.0.1)"
]},
"monkey (1.0.8)"
],
"DEPENDENCIES"
=>
[
"BananaLib (~> 1.0)"
]
}
end
end
end
describe
"Concerning the identification of changes in the Podfile"
do
describe
"Concerning the identification of changes in the Podfile"
do
...
...
spec/unit/resolver_spec.rb
View file @
b09ccf1a
...
@@ -356,6 +356,7 @@ module Pod
...
@@ -356,6 +356,7 @@ module Pod
@resolver
.
should_install?
(
"libPusher"
).
should
.
be
.
true
@resolver
.
should_install?
(
"libPusher"
).
should
.
be
.
true
end
end
# 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
platform
:ios
platform
:ios
...
...
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