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
c60a32aa
Commit
c60a32aa
authored
Apr 15, 2016
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SourcesManager] Move const_missing override to its own module
parent
3f47ead7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
27 deletions
+23
-27
sources_manager.rb
lib/cocoapods/sources_manager.rb
+23
-27
No files found.
lib/cocoapods/sources_manager.rb
View file @
c60a32aa
...
@@ -155,35 +155,31 @@ module Pod
...
@@ -155,35 +155,31 @@ module Pod
end
end
# @!visibility private
# @!visibility private
SOURCES_MANAGER_CONSTANT_WARNINGS
=
Set
.
new
module
SourcesManagerMissingConstant
SOURCES_MANAGER_CONSTANT_WARNINGS
=
Set
.
new
# Warn about deprecated use of `Pod::SourcesManager` and return the config's
# Source::Manager
#
# @return [Pod::Source::Manager]
#
def
const_missing
(
const
)
unless
const
.
to_sym
==
:SourcesManager
&&
ancestors
.
any?
{
|
a
|
a
==
::
Pod
||
a
.
name
.
start_with?
(
'Pod::'
)
}
return
super
end
# @!visibility private
calling_line
=
caller
.
first
#
if
Pod
::
SourcesManagerMissingConstant
::
SOURCES_MANAGER_CONSTANT_WARNINGS
.
add?
(
calling_line
)
# Warn about deprecated use of `Pod::SourcesManager` and return the config's
warn
'Usage of the constant `Pod::SourcesManager` is deprecated, '
\
# Source::Manager
'use `Pod::Config.instance.sources_manager` instead '
\
#
"(called from
#{
calling_line
}
)"
# @return [Pod::Source::Manager]
end
#
def
self
.
sources_manager_constant
Config
.
instance
.
sources_manager
calling_line
=
caller
[
1
]
if
SOURCES_MANAGER_CONSTANT_WARNINGS
.
add?
(
calling_line
)
warn
'Usage of the constant `Pod::SourcesManager` is deprecated, '
\
'use `Pod::Config.instance.sources_manager` instead '
\
"(called from
#{
calling_line
}
)"
end
end
Config
.
instance
.
sources_manager
end
end
end
def
Pod
.
const_missing
(
const
)
return
super
unless
const
.
to_sym
==
:SourcesManager
::
Pod
.
sources_manager_constant
end
def
Object
.
const_missing
(
const
)
extend
SourcesManagerMissingConstant
unless
const
.
to_sym
==
:SourcesManager
&&
::
Object
.
send
(
:extend
,
SourcesManagerMissingConstant
)
ancestors
.
any?
{
|
a
|
a
==
::
Pod
||
a
.
name
.
start_with?
(
'Pod::'
)
}
return
super
end
::
Pod
.
sources_manager_constant
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