Commit cc2fc7e1 authored by Fabio Pelosin's avatar Fabio Pelosin

[ExternalSources::PathSource] Fix relative path detection

Closes https://github.com/CocoaPods/CocoaPods/issues/2050
parent 583d5448
...@@ -19,7 +19,7 @@ module Pod ...@@ -19,7 +19,7 @@ module Pod
"`#{declared_path}`" "`#{declared_path}`"
end end
store_podspec(sandbox, podspec) store_podspec(sandbox, podspec)
is_absolute = absolute?(podspec) is_absolute = absolute?(declared_path)
sandbox.store_local_path(name, podspec.dirname, is_absolute) sandbox.store_local_path(name, podspec.dirname, is_absolute)
end end
end end
......
...@@ -159,7 +159,7 @@ module Pod ...@@ -159,7 +159,7 @@ module Pod
root + root_name root + root_name
end end
end end
# Returns true if the path as originally specified was absolute. # Returns true if the path as originally specified was absolute.
# #
# @param [String] name # @param [String] name
...@@ -169,7 +169,7 @@ module Pod ...@@ -169,7 +169,7 @@ module Pod
def local_path_was_absolute?(name) def local_path_was_absolute?(name)
@pods_with_absolute_path.include? name @pods_with_absolute_path.include? name
end end
# @return [Pathname] the directory where to store the documentation. # @return [Pathname] the directory where to store the documentation.
# #
def documentation_dir def documentation_dir
......
...@@ -42,6 +42,22 @@ module Pod ...@@ -42,6 +42,22 @@ module Pod
should.raise Informative do should.raise Informative do
@subject.fetch(config.sandbox) @subject.fetch(config.sandbox)
end.message.should.match /No podspec found for `Reachability` in `#{temporary_directory}`/ end.message.should.match /No podspec found for `Reachability` in `#{temporary_directory}`/
it "marks a pod as relative" do
@subject.stubs(:params).returns(:path => './Reachability')
Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec)
@subject.fetch(config.sandbox)
config.sandbox.local_path_was_absolute?('Reachability').should.be.false
end
it "marks a pod as absolute" do
@subject.stubs(:params).returns(:path => '/path/Reachability')
Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec)
@subject.fetch(config.sandbox)
config.sandbox.local_path_was_absolute?('Reachability').should.be.true
end
end end
describe "#podspec_path" do describe "#podspec_path" do
...@@ -79,6 +95,11 @@ module Pod ...@@ -79,6 +95,11 @@ module Pod
result.should.be.false result.should.be.false
end end
it "consider relative paths not explicitly set from the current dir" do
result = @subject.send(:absolute?, './ThirdPartyCode/UrbanAirship')
result.should.be.false
end
it 'returns that a path is absolute' do it 'returns that a path is absolute' do
result = @subject.send(:absolute?, '/path/to/UrbanAirship') result = @subject.send(:absolute?, '/path/to/UrbanAirship')
result.should.be.true result.should.be.true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment