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
a225e746
Commit
a225e746
authored
Mar 06, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ExternalSources] Simplify path resolution logic
parent
e46d15e1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
external_sources.rb
lib/cocoapods/external_sources.rb
+5
-8
external_sources_spec.rb
spec/unit/external_sources_spec.rb
+7
-0
No files found.
lib/cocoapods/external_sources.rb
View file @
a225e746
...
@@ -318,17 +318,14 @@ module Pod
...
@@ -318,17 +318,14 @@ module Pod
def
pod_spec_path
def
pod_spec_path
declared_path
=
params
[
:local
].
to_s
declared_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"
path_without_tilde
=
path_with_ext
.
gsub
(
'~'
,
ENV
[
'HOME'
])
podfile_dir
=
File
.
dirname
(
podfile_path
||
''
)
if
podfile_path
absolute_path
=
File
.
expand_path
(
path_with_ext
,
podfile_dir
)
absolute_path
=
Pathname
(
podfile_path
).
dirname
+
path_without_tilde
pathname
=
Pathname
.
new
(
absolute_path
)
else
absolute_path
=
Pathname
.
new
(
path_without_tilde
)
end
unless
absolute_path
.
exist?
unless
pathname
.
exist?
raise
Informative
,
"No podspec found for `
#{
name
}
` in `
#{
params
[
:local
]
}
`"
raise
Informative
,
"No podspec found for `
#{
name
}
` in `
#{
params
[
:local
]
}
`"
end
end
absolute_path
pathname
end
end
end
end
end
end
...
...
spec/unit/external_sources_spec.rb
View file @
a225e746
...
@@ -201,6 +201,13 @@ module Pod
...
@@ -201,6 +201,13 @@ module Pod
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
@external_source
.
stubs
(
:podfile_path
).
returns
(
nil
)
@external_source
.
stubs
(
:params
).
returns
(
:local
=>
fixture
(
'integration/Reachability'
))
path
=
@external_source
.
send
(
:pod_spec_path
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
end
it
"handles relative paths"
do
it
"handles relative paths"
do
@external_source
.
stubs
(
:params
).
returns
(
:local
=>
'Reachability'
)
@external_source
.
stubs
(
:params
).
returns
(
:local
=>
'Reachability'
)
path
=
@external_source
.
send
(
:pod_spec_path
)
path
=
@external_source
.
send
(
:pod_spec_path
)
...
...
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