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
c310381f
Commit
c310381f
authored
May 17, 2017
by
Ben Asher
Committed by
GitHub
May 17, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6576 from adellibovi/no-specs-update-when-not-needed
Avoid unneeded master specs cloning for pod lib lint
parents
748ef533
5f54ada4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
5 deletions
+60
-5
CHANGELOG.md
CHANGELOG.md
+3
-1
installer.rb
lib/cocoapods/installer.rb
+7
-0
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+12
-2
validator.rb
lib/cocoapods/validator.rb
+6
-1
validator_spec.rb
spec/unit/validator_spec.rb
+32
-1
No files found.
CHANGELOG.md
View file @
c310381f
...
@@ -46,7 +46,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -46,7 +46,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
##### Bug Fixes
*
None.
*
No master specs cloning when not needed for
`pod lib lint`
.
[
Alfredo Delli Bovi
](
https://github.com/adellibovi
)
[
#6154
](
https://github.com/CocoaPods/CocoaPods/issues/6154
)
## 1.2.1.rc.1 (2017-04-05)
## 1.2.1.rc.1 (2017-04-05)
...
...
lib/cocoapods/installer.rb
View file @
c310381f
...
@@ -71,6 +71,7 @@ module Pod
...
@@ -71,6 +71,7 @@ module Pod
@lockfile
=
lockfile
@lockfile
=
lockfile
@use_default_plugins
=
true
@use_default_plugins
=
true
@has_dependencies
=
true
end
end
# @return [Hash, Boolean, nil] Pods that have been requested to be
# @return [Hash, Boolean, nil] Pods that have been requested to be
...
@@ -80,6 +81,11 @@ module Pod
...
@@ -80,6 +81,11 @@ module Pod
#
#
attr_accessor
:update
attr_accessor
:update
# @return [Boolean] Whether it has dependencies. Defaults to true.
#
attr_accessor
:has_dependencies
alias_method
:has_dependencies?
,
:has_dependencies
# @return [Boolean] Whether the spec repos should be updated.
# @return [Boolean] Whether the spec repos should be updated.
#
#
attr_accessor
:repo_update
attr_accessor
:repo_update
...
@@ -238,6 +244,7 @@ module Pod
...
@@ -238,6 +244,7 @@ module Pod
def
create_analyzer
def
create_analyzer
Analyzer
.
new
(
sandbox
,
podfile
,
lockfile
).
tap
do
|
analyzer
|
Analyzer
.
new
(
sandbox
,
podfile
,
lockfile
).
tap
do
|
analyzer
|
analyzer
.
installation_options
=
installation_options
analyzer
.
installation_options
=
installation_options
analyzer
.
has_dependencies
=
has_dependencies?
end
end
end
end
...
...
lib/cocoapods/installer/analyzer.rb
View file @
c310381f
...
@@ -45,6 +45,7 @@ module Pod
...
@@ -45,6 +45,7 @@ module Pod
@update
=
false
@update
=
false
@allow_pre_downloads
=
true
@allow_pre_downloads
=
true
@has_dependencies
=
true
end
end
# Performs the analysis.
# Performs the analysis.
...
@@ -152,6 +153,15 @@ module Pod
...
@@ -152,6 +153,15 @@ module Pod
attr_accessor
:allow_pre_downloads
attr_accessor
:allow_pre_downloads
alias_method
:allow_pre_downloads?
,
:allow_pre_downloads
alias_method
:allow_pre_downloads?
,
:allow_pre_downloads
# @return [Bool] Whether the analysis has dependencies and thus
# sources must be configured.
#
# @note This is used by the `pod lib lint` command to prevent
# update of specs when not needed.
#
attr_accessor
:has_dependencies
alias_method
:has_dependencies?
,
:has_dependencies
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
private
private
...
@@ -831,11 +841,11 @@ module Pod
...
@@ -831,11 +841,11 @@ module Pod
# Add any sources specified using the :source flag on individual dependencies.
# Add any sources specified using the :source flag on individual dependencies.
dependency_sources
=
podfile
.
dependencies
.
map
(
&
:podspec_repo
).
compact
dependency_sources
=
podfile
.
dependencies
.
map
(
&
:podspec_repo
).
compact
all_dependencies_have_sources
=
dependency_sources
.
count
==
podfile
.
dependencies
.
count
all_dependencies_have_sources
=
dependency_sources
.
count
==
podfile
.
dependencies
.
count
if
all_dependencies_have_sources
if
all_dependencies_have_sources
sources
=
dependency_sources
sources
=
dependency_sources
elsif
sources
.
empty?
elsif
has_dependencies?
&&
sources
.
empty?
sources
=
[
'https://github.com/CocoaPods/Specs.git'
]
sources
=
[
'https://github.com/CocoaPods/Specs.git'
]
else
else
sources
+=
dependency_sources
sources
+=
dependency_sources
...
...
lib/cocoapods/validator.rb
View file @
c310381f
...
@@ -28,8 +28,12 @@ module Pod
...
@@ -28,8 +28,12 @@ module Pod
# the Source URLs to use in creating a {Podfile}.
# the Source URLs to use in creating a {Podfile}.
#
#
def
initialize
(
spec_or_path
,
source_urls
)
def
initialize
(
spec_or_path
,
source_urls
)
@source_urls
=
source_urls
.
map
{
|
url
|
config
.
sources_manager
.
source_with_name_or_url
(
url
)
}.
map
(
&
:url
)
@linter
=
Specification
::
Linter
.
new
(
spec_or_path
)
@linter
=
Specification
::
Linter
.
new
(
spec_or_path
)
@source_urls
=
if
@linter
.
spec
&&
@linter
.
spec
.
dependencies
.
empty?
[]
else
source_urls
.
map
{
|
url
|
config
.
sources_manager
.
source_with_name_or_url
(
url
)
}.
map
(
&
:url
)
end
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
@@ -405,6 +409,7 @@ module Pod
...
@@ -405,6 +409,7 @@ module Pod
sandbox
=
Sandbox
.
new
(
config
.
sandbox_root
)
sandbox
=
Sandbox
.
new
(
config
.
sandbox_root
)
@installer
=
Installer
.
new
(
sandbox
,
podfile
)
@installer
=
Installer
.
new
(
sandbox
,
podfile
)
@installer
.
use_default_plugins
=
false
@installer
.
use_default_plugins
=
false
@installer
.
has_dependencies
=
!
spec
.
dependencies
.
empty?
%i(prepare resolve_dependencies download_dependencies)
.
each
{
|
m
|
@installer
.
send
(
m
)
}
%i(prepare resolve_dependencies download_dependencies)
.
each
{
|
m
|
@installer
.
send
(
m
)
}
@file_accessor
=
@installer
.
pod_targets
.
flat_map
(
&
:file_accessors
).
find
{
|
fa
|
fa
.
spec
.
name
==
consumer
.
spec
.
name
}
@file_accessor
=
@installer
.
pod_targets
.
flat_map
(
&
:file_accessors
).
find
{
|
fa
|
fa
.
spec
.
name
==
consumer
.
spec
.
name
}
end
end
...
...
spec/unit/validator_spec.rb
View file @
c310381f
...
@@ -372,15 +372,46 @@ module Pod
...
@@ -372,15 +372,46 @@ module Pod
end
end
end
end
it
'
repects the source_urls parameter
'
do
it
'
empties sources when no dependencies
'
do
sources
=
%w(master https://github.com/CocoaPods/Specs.git)
sources
=
%w(master https://github.com/CocoaPods/Specs.git)
Command
::
Repo
::
Add
.
any_instance
.
stubs
(
:run
)
Command
::
Repo
::
Add
.
any_instance
.
stubs
(
:run
)
validator
=
Validator
.
new
(
podspec_path
,
sources
)
validator
=
Validator
.
new
(
podspec_path
,
sources
)
validator
.
stubs
(
:validate_url
)
validator
.
stubs
(
:validate_url
)
podfile
=
validator
.
send
(
:podfile_from_spec
,
:ios
,
'5.0'
)
podfile
=
validator
.
send
(
:podfile_from_spec
,
:ios
,
'5.0'
)
podfile
.
sources
.
should
==
%w()
end
it
'repects the source_urls parameter when there are dependencies'
do
podspec
=
stub_podspec
(
/.*name.*/
,
'"name": "SBJson",'
).
gsub
(
/.*version.*/
,
'"version": "3.2",'
)
file
=
write_podspec
(
podspec
,
'SBJson.podspec.json'
)
spec
=
Specification
.
from_file
(
file
)
set
=
mock
set
.
stubs
(
:all_specifications
).
returns
([
spec
])
Source
::
Aggregate
.
any_instance
.
stubs
(
:search
).
with
(
Dependency
.
new
(
'SBJson'
,
'~> 3.2'
)).
returns
(
set
)
podspec
=
stub_podspec
(
/.*name.*/
,
'"name": "ZKit",'
)
podspec
.
gsub!
(
/.*requires_arc.*/
,
'"dependencies": { "SBJson": [ "~> 3.2" ] }, "requires_arc": false'
)
file
=
write_podspec
(
podspec
,
'ZKit.podspec.json'
)
spec
=
Specification
.
from_file
(
file
)
sources
=
%w(master https://github.com/CocoaPods/Specs.git)
Command
::
Repo
::
Add
.
any_instance
.
stubs
(
:run
)
validator
=
Validator
.
new
(
spec
,
sources
)
validator
.
stubs
(
:validate_url
)
podfile
=
validator
.
send
(
:podfile_from_spec
,
:ios
,
'5.0'
)
podfile
.
sources
.
should
==
%w(https://github.com/CocoaPods/Specs.git)
podfile
.
sources
.
should
==
%w(https://github.com/CocoaPods/Specs.git)
end
end
it
'avoids creation of sources when no dependencies'
do
sources
=
%w(master https://github.com/CocoaPods/Specs.git)
config
.
sources_manager
.
expects
(
:find_or_create_source_with_url
).
never
Command
::
Repo
::
Add
.
any_instance
.
stubs
(
:run
)
validator
=
Validator
.
new
(
podspec_path
,
sources
)
validator
.
stubs
(
:validate_url
)
validator
.
validate
end
it
'uses xcodebuild to generate warnings'
do
it
'uses xcodebuild to generate warnings'
do
validator
=
Validator
.
new
(
podspec_path
,
config
.
sources_manager
.
master
.
map
(
&
:url
))
validator
=
Validator
.
new
(
podspec_path
,
config
.
sources_manager
.
master
.
map
(
&
:url
))
validator
.
stubs
(
:check_file_patterns
)
validator
.
stubs
(
:check_file_patterns
)
...
...
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