Permalink
Browse files

[Sandbox] Evaluate podspecs from their original path

  • Loading branch information...
1 parent c5c61f7 commit a8e5fb57748a6459ee4b88036236707321d9e539 @kylef kylef committed Jun 27, 2014
Showing with 27 additions and 4 deletions.
  1. +6 −0 CHANGELOG.md
  2. +9 −4 lib/cocoapods/sandbox.rb
  3. +12 −0 spec/unit/sandbox_spec.rb
View
@@ -13,6 +13,12 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Ash Furrow](ashfurrow]
[#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
View
@@ -191,7 +191,8 @@ def documentation_dir
#
def specification(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
@@ -253,9 +254,13 @@ def store_podspec(name, podspec, external_source = false, json = false)
end
FileUtils.copy(podspec, output_path)
end
- 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}`"
+
+ Dir.chdir(podspec.is_a?(Pathname) ? File.dirname(podspec) : Dir.pwd) do
+ 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
View
@@ -107,6 +107,18 @@ module Pod
@sandbox.specification('BananaLib').name.should == 'BananaLib'
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
@sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Local Podspecs'
end

0 comments on commit a8e5fb5

Please sign in to comment.