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
c82eb037
Commit
c82eb037
authored
Apr 19, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ExternalSources] Refine rename of the :local option to :path
See #971
parent
74b06387
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
17 deletions
+33
-17
external_sources.rb
lib/cocoapods/external_sources.rb
+10
-7
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+1
-1
sandbox.rb
lib/cocoapods/sandbox.rb
+2
-0
validator.rb
lib/cocoapods/validator.rb
+1
-1
external_sources_spec.rb
spec/unit/external_sources_spec.rb
+19
-8
No files found.
lib/cocoapods/external_sources.rb
View file @
c82eb037
...
@@ -17,10 +17,13 @@ module Pod
...
@@ -17,10 +17,13 @@ module Pod
elsif
params
.
key?
(
:svn
)
then
SvnSource
elsif
params
.
key?
(
:svn
)
then
SvnSource
elsif
params
.
key?
(
:hg
)
then
MercurialSource
elsif
params
.
key?
(
:hg
)
then
MercurialSource
elsif
params
.
key?
(
:podspec
)
then
PodspecSource
elsif
params
.
key?
(
:podspec
)
then
PodspecSource
elsif
params
.
key?
(
:local
)
||
elsif
params
.
key?
(
:path
)
then
PathSource
params
.
key?
(
:path
)
then
LocalSource
end
if
params
.
key?
(
:local
)
klass
=
PathSource
UI
.
warn
"The `:local` option of the Podfile has been renamed to `:path` and is deprecated."
\
end
end
UI
.
warn
"Using :local in a Podfile is depricated. Please use :path instead."
if
params
.
key?
(
:local
)
if
klass
if
klass
klass
.
new
(
name
,
params
,
podfile_path
)
klass
.
new
(
name
,
params
,
podfile_path
)
...
@@ -288,7 +291,7 @@ module Pod
...
@@ -288,7 +291,7 @@ module Pod
# @!group Helpers
# @!group Helpers
# @return [String] The uri of the podspec appending the name of the file
# @return [String] The uri of the podspec appending the name of the file
# and expanding it if necessary.
# and expanding it if necessary.
#
#
# @note If the declared path is expanded only if the represents a path
# @note If the declared path is expanded only if the represents a path
...
@@ -314,7 +317,7 @@ module Pod
...
@@ -314,7 +317,7 @@ module Pod
#
#
# Works with the {LocalPod::LocalSourcedPod} class.
# Works with the {LocalPod::LocalSourcedPod} class.
#
#
class
Local
Source
<
AbstractExternalSource
class
Path
Source
<
AbstractExternalSource
# @see AbstractExternalSource#fetch
# @see AbstractExternalSource#fetch
#
#
...
@@ -329,7 +332,7 @@ module Pod
...
@@ -329,7 +332,7 @@ module Pod
# @see AbstractExternalSource#description
# @see AbstractExternalSource#description
#
#
def
description
def
description
"from `
#{
params
[
:local
]
}
`"
"from `
#{
params
[
:
path
]
||
params
[
:
local
]
}
`"
end
end
#--------------------------------------#
#--------------------------------------#
...
@@ -341,7 +344,7 @@ module Pod
...
@@ -341,7 +344,7 @@ module Pod
# @return [Pathname] the path of the podspec.
# @return [Pathname] the path of the podspec.
#
#
def
podspec_path
def
podspec_path
declared_path
=
params
[
:local
]
.
to_s
declared_path
=
(
params
[
:path
]
||
params
[
:local
])
.
to_s
path_with_ext
=
File
.
extname
(
declared_path
)
==
'.podspec'
?
declared_path
:
"
#{
declared_path
}
/
#{
name
}
.podspec"
path_with_ext
=
File
.
extname
(
declared_path
)
==
'.podspec'
?
declared_path
:
"
#{
declared_path
}
/
#{
name
}
.podspec"
podfile_dir
=
File
.
dirname
(
podfile_path
||
''
)
podfile_dir
=
File
.
dirname
(
podfile_path
||
''
)
absolute_path
=
File
.
expand_path
(
path_with_ext
,
podfile_dir
)
absolute_path
=
File
.
expand_path
(
path_with_ext
,
podfile_dir
)
...
...
lib/cocoapods/installer/analyzer.rb
View file @
c82eb037
...
@@ -248,7 +248,7 @@ module Pod
...
@@ -248,7 +248,7 @@ module Pod
pods_to_fetch
=
result
.
podfile_state
.
added
+
result
.
podfile_state
.
changed
pods_to_fetch
=
result
.
podfile_state
.
added
+
result
.
podfile_state
.
changed
deps_to_fetch
=
deps_with_external_source
.
select
{
|
dep
|
pods_to_fetch
.
include?
(
dep
.
root_name
)
}
deps_to_fetch
=
deps_with_external_source
.
select
{
|
dep
|
pods_to_fetch
.
include?
(
dep
.
root_name
)
}
deps_to_fetch_if_needed
=
deps_with_external_source
.
select
{
|
dep
|
result
.
podfile_state
.
unchanged
.
include?
(
dep
.
root_name
)
}
deps_to_fetch_if_needed
=
deps_with_external_source
.
select
{
|
dep
|
result
.
podfile_state
.
unchanged
.
include?
(
dep
.
root_name
)
}
deps_to_fetch
+=
deps_to_fetch_if_needed
.
select
{
|
dep
|
sandbox
.
specification
(
dep
.
root_name
).
nil?
||
!
dep
.
external_source
[
:local
].
nil?
}
deps_to_fetch
+=
deps_to_fetch_if_needed
.
select
{
|
dep
|
sandbox
.
specification
(
dep
.
root_name
).
nil?
||
!
dep
.
external_source
[
:local
].
nil?
||
!
dep
.
external_source
[
:path
].
nil?
}
end
end
unless
deps_to_fetch
.
empty?
unless
deps_to_fetch
.
empty?
...
...
lib/cocoapods/sandbox.rb
View file @
c82eb037
...
@@ -320,6 +320,8 @@ module Pod
...
@@ -320,6 +320,8 @@ module Pod
# @return [Hash{String=>String}] The path of the Pods with a local source
# @return [Hash{String=>String}] The path of the Pods with a local source
# grouped by their name.
# grouped by their name.
#
#
# @todo Rename (e.g. `pods_with_local_path`)
#
attr_reader
:local_pods
attr_reader
:local_pods
# Checks if a Pod is locally sourced?
# Checks if a Pod is locally sourced?
...
...
lib/cocoapods/validator.rb
View file @
c82eb037
...
@@ -106,7 +106,7 @@ module Pod
...
@@ -106,7 +106,7 @@ module Pod
# @return [Bool] whether the validation should be performed against the root of
# @return [Bool] whether the validation should be performed against the root of
# the podspec instead to its original source.
# the podspec instead to its original source.
#
#
# @note Uses the `:
local
` option of the Podfile.
# @note Uses the `:
path
` option of the Podfile.
#
#
attr_writer
:local
attr_writer
:local
def
local?
;
@local
;
end
def
local?
;
@local
;
end
...
...
spec/unit/external_sources_spec.rb
View file @
c82eb037
...
@@ -8,11 +8,13 @@ module Pod
...
@@ -8,11 +8,13 @@ module Pod
svn
=
Dependency
.
new
(
"Reachability"
,
:svn
=>
nil
)
svn
=
Dependency
.
new
(
"Reachability"
,
:svn
=>
nil
)
podspec
=
Dependency
.
new
(
"Reachability"
,
:podspec
=>
nil
)
podspec
=
Dependency
.
new
(
"Reachability"
,
:podspec
=>
nil
)
local
=
Dependency
.
new
(
"Reachability"
,
:local
=>
nil
)
local
=
Dependency
.
new
(
"Reachability"
,
:local
=>
nil
)
path
=
Dependency
.
new
(
"Reachability"
,
:path
=>
nil
)
ExternalSources
.
from_dependency
(
git
,
nil
).
class
.
should
==
ExternalSources
::
GitSource
ExternalSources
.
from_dependency
(
git
,
nil
).
class
.
should
==
ExternalSources
::
GitSource
ExternalSources
.
from_dependency
(
svn
,
nil
).
class
.
should
==
ExternalSources
::
SvnSource
ExternalSources
.
from_dependency
(
svn
,
nil
).
class
.
should
==
ExternalSources
::
SvnSource
ExternalSources
.
from_dependency
(
podspec
,
nil
).
class
.
should
==
ExternalSources
::
PodspecSource
ExternalSources
.
from_dependency
(
podspec
,
nil
).
class
.
should
==
ExternalSources
::
PodspecSource
ExternalSources
.
from_dependency
(
local
,
nil
).
class
.
should
==
ExternalSources
::
LocalSource
ExternalSources
.
from_dependency
(
local
,
nil
).
class
.
should
==
ExternalSources
::
PathSource
ExternalSources
.
from_dependency
(
path
,
nil
).
class
.
should
==
ExternalSources
::
PathSource
end
end
end
end
...
@@ -202,11 +204,11 @@ module Pod
...
@@ -202,11 +204,11 @@ module Pod
#---------------------------------------------------------------------------#
#---------------------------------------------------------------------------#
describe
ExternalSources
::
Local
Source
do
describe
ExternalSources
::
Path
Source
do
before
do
before
do
podspec_path
=
fixture
(
'integration/Reachability/Reachability.podspec'
)
podspec_path
=
fixture
(
'integration/Reachability/Reachability.podspec'
)
dependency
=
Dependency
.
new
(
"Reachability"
,
:
local
=>
fixture
(
'integration/Reachability'
))
dependency
=
Dependency
.
new
(
"Reachability"
,
:
path
=>
fixture
(
'integration/Reachability'
))
podfile_path
=
fixture
(
'integration/Podfile'
)
podfile_path
=
fixture
(
'integration/Podfile'
)
@external_source
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
)
@external_source
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
)
end
end
...
@@ -217,6 +219,15 @@ module Pod
...
@@ -217,6 +219,15 @@ module Pod
path
.
should
.
exist?
path
.
should
.
exist?
end
end
it
"creates a copy of the podspec [Deprecated local option]"
do
dependency
=
Dependency
.
new
(
"Reachability"
,
:local
=>
fixture
(
'integration/Reachability'
))
podfile_path
=
fixture
(
'integration/Podfile'
)
external_source
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
)
external_source
.
fetch
(
config
.
sandbox
)
path
=
config
.
sandbox
.
root
+
'Local Podspecs/Reachability.podspec'
path
.
should
.
exist?
end
it
"returns the description"
do
it
"returns the description"
do
@external_source
.
description
.
should
.
match
%r|from `.*integration/Reachability`|
@external_source
.
description
.
should
.
match
%r|from `.*integration/Reachability`|
end
end
...
@@ -231,33 +242,33 @@ module Pod
...
@@ -231,33 +242,33 @@ module Pod
describe
"Helpers"
do
describe
"Helpers"
do
it
"handles absolute paths"
do
it
"handles absolute paths"
do
@external_source
.
stubs
(
:params
).
returns
(
:
local
=>
fixture
(
'integration/Reachability'
))
@external_source
.
stubs
(
:params
).
returns
(
:
path
=>
fixture
(
'integration/Reachability'
))
path
=
@external_source
.
send
(
:podspec_path
)
path
=
@external_source
.
send
(
:podspec_path
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
end
end
it
"handles paths when there is no podfile path"
do
it
"handles paths when there is no podfile path"
do
@external_source
.
stubs
(
:podfile_path
).
returns
(
nil
)
@external_source
.
stubs
(
:podfile_path
).
returns
(
nil
)
@external_source
.
stubs
(
:params
).
returns
(
:
local
=>
fixture
(
'integration/Reachability'
))
@external_source
.
stubs
(
:params
).
returns
(
:
path
=>
fixture
(
'integration/Reachability'
))
path
=
@external_source
.
send
(
:podspec_path
)
path
=
@external_source
.
send
(
:podspec_path
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
end
end
it
"handles relative paths"
do
it
"handles relative paths"
do
@external_source
.
stubs
(
:params
).
returns
(
:
local
=>
'Reachability'
)
@external_source
.
stubs
(
:params
).
returns
(
:
path
=>
'Reachability'
)
path
=
@external_source
.
send
(
:podspec_path
)
path
=
@external_source
.
send
(
:podspec_path
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
end
end
it
"expands the tilde"
do
it
"expands the tilde"
do
@external_source
.
stubs
(
:params
).
returns
(
:
local
=>
'~/Reachability'
)
@external_source
.
stubs
(
:params
).
returns
(
:
path
=>
'~/Reachability'
)
Pathname
.
any_instance
.
stubs
(
:exist?
).
returns
(
true
)
Pathname
.
any_instance
.
stubs
(
:exist?
).
returns
(
true
)
path
=
@external_source
.
send
(
:podspec_path
)
path
=
@external_source
.
send
(
:podspec_path
)
path
.
should
==
Pathname
(
ENV
[
'HOME'
])
+
'Reachability/Reachability.podspec'
path
.
should
==
Pathname
(
ENV
[
'HOME'
])
+
'Reachability/Reachability.podspec'
end
end
it
"raises if the podspec cannot be found"
do
it
"raises if the podspec cannot be found"
do
@external_source
.
stubs
(
:params
).
returns
(
:
local
=>
temporary_directory
)
@external_source
.
stubs
(
:params
).
returns
(
:
path
=>
temporary_directory
)
e
=
lambda
{
@external_source
.
send
(
:podspec_path
)
}.
should
.
raise
Informative
e
=
lambda
{
@external_source
.
send
(
:podspec_path
)
}.
should
.
raise
Informative
e
.
message
.
should
.
match
/No podspec found/
e
.
message
.
should
.
match
/No podspec found/
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