Commit 8765afe8 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #2893 from CocoaPods/seg-podspec-eval-context

[ExternalSource] Store downloaded external source podspecs as JSON, evaluated from the context of the source directory
parents e00268b7 be205e45
......@@ -58,6 +58,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins)
[#1919](https://github.com/CocoaPods/CocoaPods/issues/1919)
* Fix the reading of podspecs that come from the `:git`, `:svn`, ':http', or
`:hg` options in your `Podfile` that used context-dependent ruby code, such as
reading a file to determine the specification version.
[Samuel Giddins](https://github.com/segiddins)
[#2875](https://github.com/CocoaPods/CocoaPods/issues/2875)
## 0.35.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.34.4...0.35.0)
......
......@@ -7,7 +7,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Core.git
revision: c674fd2cb5249a67f558d0fd73d42275710a11c7
revision: c9c91c5296067ebf5af122ed87580e9f0479b47c
branch: master
specs:
cocoapods-core (0.35.0)
......
......@@ -30,7 +30,7 @@ module Pod
def run
require 'json'
spec = Specification.from_file(@path)
output_pipe.puts(JSON.pretty_generate(spec))
output_pipe.puts(spec.to_pretty_json)
end
end
......
......@@ -138,6 +138,10 @@ module Pod
# @return [void]
#
def store_podspec(sandbox, spec, json = false)
if spec.is_a? Pathname
spec = Specification.from_file(spec).to_pretty_json
json = true
end
sandbox.store_podspec(name, spec, true, json)
end
end
......
......@@ -37,7 +37,7 @@ module Pod
it 'pre-downloads the Pod and stores the relevant information in the sandbox' do
@subject.send(:pre_download, config.sandbox)
path = config.sandbox.specifications_root + 'Reachability.podspec'
path = config.sandbox.specifications_root + 'Reachability.podspec.json'
path.should.exist?
config.sandbox.predownloaded_pods.should == ['Reachability']
config.sandbox.checkout_sources.should == {
......@@ -52,10 +52,10 @@ module Pod
path = config.sandbox.pod_dir('Reachability')
podspec_path = path + 'Reachability.podspec.json'
Dir.mkdir(path)
File.open(podspec_path, 'w') {}
File.open(podspec_path, 'w') { |f| f.write '{}' }
Pathname.any_instance.stubs(:rmtree)
Downloader::Git.any_instance.stubs(:download)
config.sandbox.expects(:store_podspec).with('Reachability', podspec_path, true, true)
config.sandbox.expects(:store_podspec).with('Reachability', "{\n}\n", true, true)
@subject.send(:pre_download, config.sandbox)
end
end
......
......@@ -13,7 +13,7 @@ module Pod
it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox)
path = config.sandbox.specifications_root + 'Reachability.podspec'
path = config.sandbox.specifications_root + 'Reachability.podspec.json'
path.should.exist?
end
......
......@@ -12,7 +12,7 @@ module Pod
it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox)
path = config.sandbox.specifications_root + 'Reachability.podspec'
path = config.sandbox.specifications_root + 'Reachability.podspec.json'
path.should.exist?
end
......@@ -22,7 +22,7 @@ module Pod
podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path)
@subject.fetch(config.sandbox)
path = config.sandbox.specifications_root + 'Reachability.podspec'
path = config.sandbox.specifications_root + 'Reachability.podspec.json'
path.should.exist?
end
......@@ -52,7 +52,7 @@ module Pod
end
it 'marks a pod as absolute' do
@subject.stubs(:params).returns(:path => '/path/Reachability')
@subject.stubs(:params).returns(:path => fixture('integration/Reachability'))
Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec)
@subject.fetch(config.sandbox)
......
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