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
20268749
Commit
20268749
authored
May 31, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make updating specs repos its own UI section
parent
91f1aee8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
41 deletions
+56
-41
Gemfile.lock
Gemfile.lock
+1
-1
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.
Gemfile.lock
View file @
20268749
...
...
@@ -200,4 +200,4 @@ DEPENDENCIES
xcodeproj!
BUNDLED WITH
1.10.
0
1.10.
2
lib/cocoapods/command/outdated.rb
View file @
20268749
...
...
@@ -98,7 +98,7 @@ module Pod
def
spec_sets
@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
))
installed_pods
.
map
do
|
pod_name
|
aggregate
.
search
(
Dependency
.
new
(
pod_name
))
...
...
lib/cocoapods/installer.rb
View file @
20268749
...
...
@@ -110,8 +110,14 @@ module Pod
end
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
analyze
analyze
(
analyzer
)
validate_build_configurations
prepare_for_legacy_compatibility
clean_sandbox
...
...
@@ -179,24 +185,16 @@ module Pod
#
# @return [void]
#
# @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
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
)
def
analyze
(
analyzer
=
create_analyzer
)
analyzer
.
update
=
update
@analysis_result
=
analyzer
.
analyze
@aggregate_targets
=
analyzer
.
result
.
targets
end
def
create_analyzer
Analyzer
.
new
(
sandbox
,
podfile
,
lockfile
)
end
# Ensures that the white-listed build configurations are known to prevent
# silent typos.
#
...
...
lib/cocoapods/installer/analyzer.rb
View file @
20268749
...
...
@@ -52,7 +52,7 @@ module Pod
# @return [AnalysisResult]
#
def
analyze
(
allow_fetches
=
true
)
update_repositories_if_needed
if
allow_fetches
validate_lockfile_version!
@result
=
AnalysisResult
.
new
compute_target_platforms
@result
.
podfile_state
=
generate_podfile_state
...
...
@@ -145,6 +145,19 @@ module Pod
# @!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
# dependencies should be locked.
#
...
...
@@ -174,22 +187,22 @@ module Pod
end
end
public
# Updates the git source repositories unless the config indicates to skip it.
#
def
update_repositories_if_needed
unless
config
.
skip_repo_update?
UI
.
section
'Updating spec repositories'
do
sources
.
each
do
|
source
|
if
SourcesManager
.
git_repo?
(
source
.
repo
)
SourcesManager
.
update
(
source
.
name
)
else
UI
.
message
"Skipping `
#{
source
.
name
}
` update because the repository is not a git source repository."
end
end
def
update_repositories
sources
.
each
do
|
source
|
if
SourcesManager
.
git_repo?
(
source
.
repo
)
SourcesManager
.
update
(
source
.
name
)
else
UI
.
message
"Skipping `
#{
source
.
name
}
` update because the repository is not a git source repository."
end
end
end
private
# Creates the models that represent the libraries generated by CocoaPods.
#
# @return [Array<Target>] the generated libraries.
...
...
spec/unit/installer/analyzer_spec.rb
View file @
20268749
...
...
@@ -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
config
.
skip_repo_update
=
false
@analyzer
.
stubs
(
:sources
).
returns
(
SourcesManager
.
master
)
SourcesManager
.
expects
(
:update
).
once
.
with
(
'master'
)
@analyzer
.
analyze
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
@analyzer
.
update_repositories
end
it
'does not update non-git repositories'
do
...
...
@@ -90,7 +78,7 @@ module Pod
SourcesManager
.
expects
(
:update
).
never
analyzer
=
Pod
::
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
podfile
,
nil
)
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./
...
...
spec/unit/installer_spec.rb
View file @
20268749
...
...
@@ -223,6 +223,22 @@ module Pod
#-------------------------------------------------------------------------#
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
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'
))
...
...
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