Skip to content

Commit

Permalink
[Sandbox] Evaluate podspecs from their original path
Browse files Browse the repository at this point in the history
  • Loading branch information
kylef committed Jun 27, 2014
1 parent c5c61f7 commit a8e5fb5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 9 additions & 4 deletions lib/cocoapods/sandbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions spec/unit/sandbox_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a8e5fb5

Please sign in to comment.