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
03c60f3c
Commit
03c60f3c
authored
May 31, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3625 from CocoaPods/seg-update-repos-label
Make updating specs repos its own UI section
parents
a59bd1b8
20268749
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
40 deletions
+55
-40
outdated.rb
lib/cocoapods/command/outdated.rb
+1
-1
installer.rb
lib/cocoapods/installer.rb
+12
-14
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+24
-11
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+2
-14
installer_spec.rb
spec/unit/installer_spec.rb
+16
-0
No files found.
lib/cocoapods/command/outdated.rb
View file @
03c60f3c
...
@@ -98,7 +98,7 @@ module Pod
...
@@ -98,7 +98,7 @@ module Pod
def
spec_sets
def
spec_sets
@spec_sets
||=
begin
@spec_sets
||=
begin
analyzer
.
send
(
:update_repositories
_if_needed
)
analyzer
.
send
(
:update_repositories
)
unless
config
.
skip_repo_update?
aggregate
=
Source
::
Aggregate
.
new
(
analyzer
.
sources
.
map
(
&
:repo
))
aggregate
=
Source
::
Aggregate
.
new
(
analyzer
.
sources
.
map
(
&
:repo
))
installed_pods
.
map
do
|
pod_name
|
installed_pods
.
map
do
|
pod_name
|
aggregate
.
search
(
Dependency
.
new
(
pod_name
))
aggregate
.
search
(
Dependency
.
new
(
pod_name
))
...
...
lib/cocoapods/installer.rb
View file @
03c60f3c
...
@@ -110,8 +110,14 @@ module Pod
...
@@ -110,8 +110,14 @@ module Pod
end
end
def
resolve_dependencies
def
resolve_dependencies
analyzer
=
create_analyzer
UI
.
section
'Updating local specs repositories'
do
analyzer
.
update_repositories
end
unless
config
.
skip_repo_update?
UI
.
section
'Analyzing dependencies'
do
UI
.
section
'Analyzing dependencies'
do
analyze
analyze
(
analyzer
)
validate_build_configurations
validate_build_configurations
prepare_for_legacy_compatibility
prepare_for_legacy_compatibility
clean_sandbox
clean_sandbox
...
@@ -179,24 +185,16 @@ module Pod
...
@@ -179,24 +185,16 @@ module Pod
#
#
# @return [void]
# @return [void]
#
#
# @note The warning about the version of the Lockfile doesn't use the
def
analyze
(
analyzer
=
create_analyzer
)
# `UI.warn` method because it prints the output only at the end
# of the installation. At that time CocoaPods could have crashed.
#
def
analyze
if
lockfile
&&
lockfile
.
cocoapods_version
>
Version
.
new
(
VERSION
)
STDERR
.
puts
'[!] The version of CocoaPods used to generate '
\
"the lockfile (
#{
lockfile
.
cocoapods_version
}
) is "
\
"higher than the version of the current executable (
#{
VERSION
}
). "
\
'Incompatibility issues may arise.'
.
yellow
end
analyzer
=
Analyzer
.
new
(
sandbox
,
podfile
,
lockfile
)
analyzer
.
update
=
update
analyzer
.
update
=
update
@analysis_result
=
analyzer
.
analyze
@analysis_result
=
analyzer
.
analyze
@aggregate_targets
=
analyzer
.
result
.
targets
@aggregate_targets
=
analyzer
.
result
.
targets
end
end
def
create_analyzer
Analyzer
.
new
(
sandbox
,
podfile
,
lockfile
)
end
# Ensures that the white-listed build configurations are known to prevent
# Ensures that the white-listed build configurations are known to prevent
# silent typos.
# silent typos.
#
#
...
...
lib/cocoapods/installer/analyzer.rb
View file @
03c60f3c
...
@@ -52,7 +52,7 @@ module Pod
...
@@ -52,7 +52,7 @@ module Pod
# @return [AnalysisResult]
# @return [AnalysisResult]
#
#
def
analyze
(
allow_fetches
=
true
)
def
analyze
(
allow_fetches
=
true
)
update_repositories_if_needed
if
allow_fetches
validate_lockfile_version!
@result
=
AnalysisResult
.
new
@result
=
AnalysisResult
.
new
compute_target_platforms
compute_target_platforms
@result
.
podfile_state
=
generate_podfile_state
@result
.
podfile_state
=
generate_podfile_state
...
@@ -145,6 +145,19 @@ module Pod
...
@@ -145,6 +145,19 @@ module Pod
# @!group Analysis steps
# @!group Analysis steps
# @note The warning about the version of the Lockfile doesn't use the
# `UI.warn` method because it prints the output only at the end
# of the installation. At that time CocoaPods could have crashed.
#
def
validate_lockfile_version!
if
lockfile
&&
lockfile
.
cocoapods_version
>
Version
.
new
(
VERSION
)
STDERR
.
puts
'[!] The version of CocoaPods used to generate '
\
"the lockfile (
#{
lockfile
.
cocoapods_version
}
) is "
\
"higher than the version of the current executable (
#{
VERSION
}
). "
\
'Incompatibility issues may arise.'
.
yellow
end
end
# Compares the {Podfile} with the {Lockfile} in order to detect which
# Compares the {Podfile} with the {Lockfile} in order to detect which
# dependencies should be locked.
# dependencies should be locked.
#
#
...
@@ -174,22 +187,22 @@ module Pod
...
@@ -174,22 +187,22 @@ module Pod
end
end
end
end
public
# Updates the git source repositories unless the config indicates to skip it.
# Updates the git source repositories unless the config indicates to skip it.
#
#
def
update_repositories_if_needed
def
update_repositories
unless
config
.
skip_repo_update?
sources
.
each
do
|
source
|
UI
.
section
'Updating spec repositories'
do
if
SourcesManager
.
git_repo?
(
source
.
repo
)
sources
.
each
do
|
source
|
SourcesManager
.
update
(
source
.
name
)
if
SourcesManager
.
git_repo?
(
source
.
repo
)
else
SourcesManager
.
update
(
source
.
name
)
UI
.
message
"Skipping `
#{
source
.
name
}
` update because the repository is not a git source repository."
else
UI
.
message
"Skipping `
#{
source
.
name
}
` update because the repository is not a git source repository."
end
end
end
end
end
end
end
end
private
# Creates the models that represent the libraries generated by CocoaPods.
# Creates the models that represent the libraries generated by CocoaPods.
#
#
# @return [Array<Target>] the generated libraries.
# @return [Array<Target>] the generated libraries.
...
...
spec/unit/installer/analyzer_spec.rb
View file @
03c60f3c
...
@@ -52,23 +52,11 @@ module Pod
...
@@ -52,23 +52,11 @@ module Pod
#--------------------------------------#
#--------------------------------------#
it
'updates the repositories by default'
do
config
.
skip_repo_update
=
false
SourcesManager
.
expects
(
:update
).
once
@analyzer
.
analyze
end
it
'does not update unused sources'
do
it
'does not update unused sources'
do
config
.
skip_repo_update
=
false
config
.
skip_repo_update
=
false
@analyzer
.
stubs
(
:sources
).
returns
(
SourcesManager
.
master
)
@analyzer
.
stubs
(
:sources
).
returns
(
SourcesManager
.
master
)
SourcesManager
.
expects
(
:update
).
once
.
with
(
'master'
)
SourcesManager
.
expects
(
:update
).
once
.
with
(
'master'
)
@analyzer
.
analyze
@analyzer
.
update_repositories
end
it
'does not updates the repositories if config indicates to skip them'
do
config
.
skip_repo_update
=
true
SourcesManager
.
expects
(
:update
).
never
@analyzer
.
analyze
end
end
it
'does not update non-git repositories'
do
it
'does not update non-git repositories'
do
...
@@ -90,7 +78,7 @@ module Pod
...
@@ -90,7 +78,7 @@ module Pod
SourcesManager
.
expects
(
:update
).
never
SourcesManager
.
expects
(
:update
).
never
analyzer
=
Pod
::
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
podfile
,
nil
)
analyzer
=
Pod
::
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
podfile
,
nil
)
analyzer
.
stubs
(
:sources
).
returns
([
source
])
analyzer
.
stubs
(
:sources
).
returns
([
source
])
analyzer
.
analyze
analyzer
.
update_repositories
UI
.
output
.
should
.
match
/Skipping `
#{
source
.
name
}
` update because the repository is not a git source repository./
UI
.
output
.
should
.
match
/Skipping `
#{
source
.
name
}
` update because the repository is not a git source repository./
...
...
spec/unit/installer_spec.rb
View file @
03c60f3c
...
@@ -223,6 +223,22 @@ module Pod
...
@@ -223,6 +223,22 @@ module Pod
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
describe
'Dependencies Resolution'
do
describe
'Dependencies Resolution'
do
describe
'updating spec repos'
do
it
'does not updates the repositories if config indicates to skip them'
do
config
.
skip_repo_update
=
true
SourcesManager
.
expects
(
:update
).
never
@installer
.
send
(
:resolve_dependencies
)
end
it
'updates the repositories by default'
do
config
.
skip_repo_update
=
false
SourcesManager
.
expects
(
:update
).
once
@installer
.
send
(
:resolve_dependencies
)
end
end
#--------------------------------------#
describe
'#analyze'
do
describe
'#analyze'
do
it
'prints a warning if the version of the Lockfile is higher than the one of the executable'
do
it
'prints a warning if the version of the Lockfile is higher than the one of the executable'
do
Lockfile
.
any_instance
.
stubs
(
:cocoapods_version
).
returns
(
Version
.
new
(
'999'
))
Lockfile
.
any_instance
.
stubs
(
:cocoapods_version
).
returns
(
Version
.
new
(
'999'
))
...
...
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