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
Show 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
end
.
compact
end
# Install the pods. If the resolver wants the installation of pod it is done
# even if it exits. In any case if the pod doesn't exits it is installed.
# Install the Pods. If the resolver indicated that a Pod should be installed
# and it exits, it is removed an then reinstalled. In any case if the Pod
# doesn't exits it is installed.
#
# @return [void]
#
...
...
@@ -149,7 +150,7 @@ module Pod
# we loop over target installers instead of pods, because we yield the target installer
# to the spec post install hook.
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
)
end
end
...
...
@@ -170,6 +171,15 @@ module Pod
target_installer
.
target
.
source_build_phases
.
first
<<
project_file
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
# dependency that is not a download-only one.
def
pods
...
...
@@ -188,14 +198,6 @@ module Pod
result
end
def
specifications
specs_by_target
.
values
.
flatten
end
def
specs_by_target
@specs_by_target
||=
@resolver
.
resolve
end
private
def
print_title
(
title
,
only_verbose
=
true
)
...
...
lib/cocoapods/lockfile.rb
View file @
b09ccf1a
...
...
@@ -27,19 +27,9 @@ module Pod
#
attr_reader
:to_hash
# @param [Pathname] the path of the 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.
# @param [Hash] hash A Hash representation of a Lockfile.
#
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
end
...
...
@@ -217,7 +207,8 @@ module Pod
to_hash
.
to_yaml
.
gsub
(
/^--- ?\n/
,
""
).
gsub
(
/^([A-Z])/
,
"
\n\\
1"
)
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
)
hash
=
{}
...
...
lib/cocoapods/resolver.rb
View file @
b09ccf1a
...
...
@@ -22,17 +22,17 @@ module Pod
#
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.
#
attr_reader
:sandbox
# @return [Array<Strings>] The name of the pods
coming from
an
# external source
s
# @return [Array<Strings>] The name of the pods
that have
an
# external source
.
#
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
...
...
@@ -50,15 +50,10 @@ module Pod
@podfile
=
podfile
@lockfile
=
lockfile
@sandbox
=
sandbox
@update_external_specs
=
true
@cached_sets
=
{}
@cached_sources
=
Source
::
Aggregate
.
new
@cached_specs
=
{}
@specs_by_target
=
{}
@pods_from_external_sources
=
[]
@dependencies_podfile_incompatible
=
[]
@log_indent
=
0
;
end
# Identifies the specifications that should be installed according whether
...
...
@@ -67,6 +62,11 @@ module Pod
# @return [Hash{Podfile::TargetDefinition => Array<Specification>}] specs_by_target
#
def
resolve
@cached_specs
=
{}
@specs_by_target
=
{}
@pods_from_external_sources
=
[]
@log_indent
=
0
;
if
@lockfile
puts
"
\n
Finding added, modified or removed dependencies:"
.
green
if
config
.
verbose?
@pods_by_state
=
@lockfile
.
detect_changes_with_podfile
(
podfile
)
...
...
@@ -137,8 +137,8 @@ module Pod
end
# @return [Array<Strings>] The name of the pods that were installed
# but don't have any dependency anymore.
It returns the nam
e
#
of the Pod
stripped from subspecs.
# but don't have any dependency anymore.
The name of the Pods ar
e
# stripped from subspecs.
#
def
removed_pods
return
[]
unless
lockfile
...
...
@@ -152,8 +152,7 @@ module Pod
private
# Locks the version of the previously installed pods if they are still
# compatible and were required by the Podfile.
# Locks the given Pods to the version stored in the Lockfile.
#
# @return [void]
#
...
...
@@ -221,8 +220,8 @@ module Pod
spec
.
version
.
head
=
dependency
.
head?
# And recursively load the dependencies of the spec.
find_dependency_specs
(
spec
,
spec
.
dependencies
,
target_definition
)
if
spec
.
dependencies
validate_platform
(
spec
||
@cached_specs
[
dependency
.
name
],
target_definition
)
end
validate_platform
(
spec
||
@cached_specs
[
dependency
.
name
],
target_definition
)
end
@log_indent
-=
1
end
...
...
lib/cocoapods/specification.rb
View file @
b09ccf1a
...
...
@@ -447,7 +447,7 @@ module Pod
end
def
to_s
version
?
"
#{
name
}
(
#{
version
}
)"
:
name
"
#{
name
}
(
#{
version
}
)"
end
def
inspect
...
...
spec/unit/lockfile_spec.rb
View file @
b09ccf1a
...
...
@@ -164,28 +164,6 @@ COCOAPODS: 0.11.1
lockfile
=
Pod
::
Lockfile
.
from_file
(
temporary_directory
+
'Podfile.lock_not_existing'
)
lockfile
.
should
==
nil
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
describe
"Concerning the identification of changes in the Podfile"
do
...
...
spec/unit/resolver_spec.rb
View file @
b09ccf1a
...
...
@@ -356,6 +356,7 @@ module Pod
@resolver
.
should_install?
(
"libPusher"
).
should
.
be
.
true
end
# TODO: stub the specification resolution for the sandbox
xit
"it always suggests to update pods from external sources"
do
podfile
=
Podfile
.
new
do
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