Commit a8e5fb57 authored by Kyle Fuller's avatar Kyle Fuller

[Sandbox] Evaluate podspecs from their original path

Re https://github.com/CocoaPods/pod-template/issues/50
parent c5c61f76
...@@ -13,6 +13,12 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -13,6 +13,12 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Ash Furrow](ashfurrow] [Ash Furrow](ashfurrow]
[#2136](https://github.com/CocoaPods/CocoaPods/issues/2136) [#2136](https://github.com/CocoaPods/CocoaPods/issues/2136)
* Always evaluate podspecs from the original podspec directory. This fixes
issues when you are using relative paths inside ruby podspecs and using a
pod's via `:path`.
[Kyle Fuller](kylef)
[pod-template#50](https://github.com/CocoaPods/pod-template/issues/50)
## 0.33.1 ## 0.33.1
......
...@@ -191,7 +191,8 @@ module Pod ...@@ -191,7 +191,8 @@ module Pod
# #
def specification(name) def specification(name)
if file = specification_path(name) if file = specification_path(name)
Specification.from_file(file) original_path = development_pods[name]
Dir.chdir(original_path || Dir.pwd) { Specification.from_file(file) }
end end
end end
...@@ -253,9 +254,13 @@ module Pod ...@@ -253,9 +254,13 @@ module Pod
end end
FileUtils.copy(podspec, output_path) FileUtils.copy(podspec, output_path)
end end
spec = Specification.from_file(output_path)
unless spec.name == name Dir.chdir(podspec.is_a?(Pathname) ? File.dirname(podspec) : Dir.pwd) do
raise Informative, "The name of the given podspec `#{spec.name}` doesn't match the expected one `#{name}`" spec = Specification.from_file(output_path)
unless spec.name == name
raise Informative, "The name of the given podspec `#{spec.name}` doesn't match the expected one `#{name}`"
end
end end
end end
......
...@@ -107,6 +107,18 @@ module Pod ...@@ -107,6 +107,18 @@ module Pod
@sandbox.specification('BananaLib').name.should == 'BananaLib' @sandbox.specification('BananaLib').name.should == 'BananaLib'
end end
it "loads the stored specification from the original path" do
spec_file = fixture('banana-lib/BananaLib.podspec')
spec = Specification.from_file(spec_file)
Specification.expects(:from_file).with do
Dir.pwd == fixture('banana-lib').to_s
end.twice.returns(spec)
@sandbox.store_podspec('BananaLib', spec_file)
@sandbox.store_local_path('BananaLib', fixture('banana-lib'))
@sandbox.specification('BananaLib')
end
it "returns the directory where to store the specifications" do it "returns the directory where to store the specifications" do
@sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Local Podspecs' @sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Local Podspecs'
end end
......
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