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
f49a5cec
Commit
f49a5cec
authored
Jun 26, 2013
by
François Benaiteau
Committed by
Fabio Pelosin
Aug 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Resolver] Support for specification of sources
parent
79d2b1f6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
5 deletions
+103
-5
CHANGELOG.md
CHANGELOG.md
+9
-0
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+11
-2
resolver.rb
lib/cocoapods/resolver.rb
+1
-1
sources_manager.rb
lib/cocoapods/sources_manager.rb
+43
-2
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+23
-0
sources_manager_spec.rb
spec/unit/sources_manager_spec.rb
+16
-0
No files found.
CHANGELOG.md
View file @
f49a5cec
...
@@ -18,6 +18,14 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
...
@@ -18,6 +18,14 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[
#1668
](
https://github.com/CocoaPods/CocoaPods/pull/1668
)
[
#1668
](
https://github.com/CocoaPods/CocoaPods/pull/1668
)
[
#731
](
https://github.com/CocoaPods/CocoaPods/pull/731
)
[
#731
](
https://github.com/CocoaPods/CocoaPods/pull/731
)
*
Added specific repo sources support. Allows to specify in podfile
which sources should be used to retrieve specs from and the priority
order. Example:
`source 'netbe'`
, or source 'master'. 'master' being
default github cocoapods specs repo.
[
François Benaiteau
](
https://github.com/netbe
)
[
#1143
](
https://github.com/CocoaPods/CocoaPods/pull/1143
)
[
Core#19
](
https://github.com/CocoaPods/Core/pull/19
)
*
Added hooks for plugins. Currently only the installer hook is supported.
*
Added hooks for plugins. Currently only the installer hook is supported.
A plugin can register itself to be activated after the installation with the
A plugin can register itself to be activated after the installation with the
following syntax:
following syntax:
...
@@ -101,6 +109,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
...
@@ -101,6 +109,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[
Fabio Pelosin
][
FabioPelosin
]
[
Fabio Pelosin
][
FabioPelosin
]
[
#34
](
https://github.com/CocoaPods/CLAide/issues/34
)
[
#34
](
https://github.com/CocoaPods/CLAide/issues/34
)
## 0.33.0
## 0.33.0
##### Breaking
##### Breaking
...
...
lib/cocoapods/installer/analyzer.rb
View file @
f49a5cec
...
@@ -169,8 +169,17 @@ module Pod
...
@@ -169,8 +169,17 @@ module Pod
#
#
def
update_repositories_if_needed
def
update_repositories_if_needed
unless
config
.
skip_repo_update?
unless
config
.
skip_repo_update?
UI
.
section
'Updating spec repositories'
do
sources
=
SourcesManager
.
podfile_sources
SourcesManager
.
update
if
sources
.
empty?
UI
.
section
'Updating spec repositories'
do
SourcesManager
.
update
end
else
sources
.
each
do
|
source
|
UI
.
section
"Updating spec repository
#{
source
}
"
do
SourcesManager
.
update
(
source
)
end
end
end
end
end
end
end
end
...
...
lib/cocoapods/resolver.rb
View file @
f49a5cec
...
@@ -51,7 +51,7 @@ module Pod
...
@@ -51,7 +51,7 @@ module Pod
# definition.
# definition.
#
#
def
resolve
def
resolve
@cached_sources
=
SourcesManager
.
aggregate
@cached_sources
=
SourcesManager
.
aggregate
(
true
)
@cached_sets
=
{}
@cached_sets
=
{}
@cached_specs
=
{}
@cached_specs
=
{}
@specs_by_target
=
{}
@specs_by_target
=
{}
...
...
lib/cocoapods/sources_manager.rb
View file @
f49a5cec
...
@@ -5,11 +5,30 @@ module Pod
...
@@ -5,11 +5,30 @@ module Pod
class
<<
self
class
<<
self
include
Config
::
Mixin
include
Config
::
Mixin
# @return [Array<Source>] the sources listed by the current Podfile.
#
def
podfile_sources
sources
=
[]
self
.
podfile_repos_dirs
.
each
do
|
repo
|
sources
<<
Source
.
new
(
repo
)
end
sources
<<
Source
.
new
(
master_repo_dir
)
if
sources
.
empty?
sources
end
# @param [Bool] podfile use podfile sources
#
# @return [Source::Aggregate] the aggregate of all the sources known to
# @return [Source::Aggregate] the aggregate of all the sources known to
# this installation of CocoaPods.
# this installation of CocoaPods.
#
#
def
aggregate
def
aggregate
(
podfile
=
false
)
Source
::
Aggregate
.
new
(
config
.
repos_dir
)
if
podfile
repos
=
podfile_repos_dirs
else
repos
=
config
.
repos_dir
.
children
.
select
(
&
:directory?
)
end
Source
::
Aggregate
.
new
(
repos
)
end
end
# @return [Array<Source>] the list of all the sources known to this
# @return [Array<Source>] the list of all the sources known to this
...
@@ -287,6 +306,9 @@ module Pod
...
@@ -287,6 +306,9 @@ module Pod
master_repo_dir
.
exist?
&&
repo_compatible?
(
master_repo_dir
)
master_repo_dir
.
exist?
&&
repo_compatible?
(
master_repo_dir
)
end
end
public
# @!group Source repos
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
private
private
...
@@ -324,6 +346,25 @@ module Pod
...
@@ -324,6 +346,25 @@ module Pod
git_repo?
(
source
.
data_provider
.
repo
)
git_repo?
(
source
.
data_provider
.
repo
)
end
end
end
end
# @return [Array<Pathname>] directories of all specified sources in
# Podfile
#
def
podfile_repos_dirs
pathnames
=
[]
if
config
.
podfile
config
.
podfile
.
sources
.
each
do
|
source_name
|
pathnames
<<
source_repo_dir
(
source_name
)
end
end
pathnames
end
# @return [Pathname] the directory where a given CocoaPods source is stored.
#
def
source_repo_dir
(
name
)
config
.
repos_dir
+
name
end
end
end
end
end
end
end
spec/unit/installer/analyzer_spec.rb
View file @
f49a5cec
...
@@ -468,7 +468,30 @@ module Pod
...
@@ -468,7 +468,30 @@ module Pod
end
end
#--------------------------------------#
#--------------------------------------#
describe
"#update_repositories_if_needed"
do
it
"updates the podfile repositories"
do
config
.
skip_repo_update
=
false
def
@podfile
.
sources
[
"netbe"
,
"master"
]
end
SourcesManager
.
expects
(
:update
).
with
(
"netbe"
).
once
SourcesManager
.
expects
(
:update
).
with
(
"master"
).
once
@analyzer
.
send
(
:update_repositories_if_needed
)
end
it
"updates the default repositories"
do
config
.
skip_repo_update
=
false
def
@podfile
.
sources
[]
end
SourcesManager
.
expects
(
:update
).
once
@analyzer
.
send
(
:update_repositories_if_needed
)
end
end
end
end
end
end
end
end
spec/unit/sources_manager_spec.rb
View file @
f49a5cec
...
@@ -105,6 +105,22 @@ module Pod
...
@@ -105,6 +105,22 @@ module Pod
path
=
SourcesManager
.
search_index_path
.
to_s
path
=
SourcesManager
.
search_index_path
.
to_s
path
.
should
.
match
%r[Library/Caches/CocoaPods/search_index.yaml]
path
.
should
.
match
%r[Library/Caches/CocoaPods/search_index.yaml]
end
end
it
"returns the sources from podfile"
do
@podfile
=
Podfile
.
new
do
platform
:ios
source
'netbe'
source
'cocoapods'
end
SourcesManager
.
config
.
stubs
(
:podfile
).
returns
(
@podfile
)
sources
=
SourcesManager
.
podfile_sources
sources
.
map
(
&
:name
).
should
==
%w[netbe cocoapods]
end
it
"returns cocoapods source if none specified"
do
sources
=
SourcesManager
.
podfile_sources
sources
.
map
(
&
:name
).
should
==
%w[master]
end
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
...
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