Commit f9d3ec07 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[ExternalSource] Store downloaded external source podspecs as JSON, evaluated…

[ExternalSource] Store downloaded external source podspecs as JSON, evaluated from the context of the source directory
parent e00268b7
...@@ -15,7 +15,7 @@ gem 'json', '1.7.7' ...@@ -15,7 +15,7 @@ gem 'json', '1.7.7'
group :development do group :development do
cp_gem 'claide', 'CLAide' cp_gem 'claide', 'CLAide'
cp_gem 'cocoapods-core', 'Core' cp_gem 'cocoapods-core', 'Core', 'seg-podspec-eval-context'
cp_gem 'cocoapods-downloader', 'cocoapods-downloader' cp_gem 'cocoapods-downloader', 'cocoapods-downloader'
cp_gem 'cocoapods-plugins', 'cocoapods-plugins' cp_gem 'cocoapods-plugins', 'cocoapods-plugins'
cp_gem 'cocoapods-trunk', 'cocoapods-trunk' cp_gem 'cocoapods-trunk', 'cocoapods-trunk'
......
...@@ -7,8 +7,8 @@ GIT ...@@ -7,8 +7,8 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/Core.git
revision: c674fd2cb5249a67f558d0fd73d42275710a11c7 revision: 995e12321cd13b6eb66a07e4bc5d156e749b1537
branch: master branch: seg-podspec-eval-context
specs: specs:
cocoapods-core (0.35.0) cocoapods-core (0.35.0)
activesupport (>= 3.2.15) activesupport (>= 3.2.15)
......
...@@ -138,6 +138,10 @@ module Pod ...@@ -138,6 +138,10 @@ module Pod
# @return [void] # @return [void]
# #
def store_podspec(sandbox, spec, json = false) 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) sandbox.store_podspec(name, spec, true, json)
end end
end end
......
...@@ -37,7 +37,7 @@ module Pod ...@@ -37,7 +37,7 @@ module Pod
it 'pre-downloads the Pod and stores the relevant information in the sandbox' do it 'pre-downloads the Pod and stores the relevant information in the sandbox' do
@subject.send(:pre_download, config.sandbox) @subject.send(:pre_download, config.sandbox)
path = config.sandbox.specifications_root + 'Reachability.podspec' path = config.sandbox.specifications_root + 'Reachability.podspec.json'
path.should.exist? path.should.exist?
config.sandbox.predownloaded_pods.should == ['Reachability'] config.sandbox.predownloaded_pods.should == ['Reachability']
config.sandbox.checkout_sources.should == { config.sandbox.checkout_sources.should == {
...@@ -52,10 +52,10 @@ module Pod ...@@ -52,10 +52,10 @@ module Pod
path = config.sandbox.pod_dir('Reachability') path = config.sandbox.pod_dir('Reachability')
podspec_path = path + 'Reachability.podspec.json' podspec_path = path + 'Reachability.podspec.json'
Dir.mkdir(path) Dir.mkdir(path)
File.open(podspec_path, 'w') {} File.open(podspec_path, 'w') { |f| f.write '{}' }
Pathname.any_instance.stubs(:rmtree) Pathname.any_instance.stubs(:rmtree)
Downloader::Git.any_instance.stubs(:download) 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) @subject.send(:pre_download, config.sandbox)
end end
end end
......
...@@ -13,7 +13,7 @@ module Pod ...@@ -13,7 +13,7 @@ module Pod
it 'creates a copy of the podspec' do it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox) @subject.fetch(config.sandbox)
path = config.sandbox.specifications_root + 'Reachability.podspec' path = config.sandbox.specifications_root + 'Reachability.podspec.json'
path.should.exist? path.should.exist?
end end
......
...@@ -12,7 +12,7 @@ module Pod ...@@ -12,7 +12,7 @@ module Pod
it 'creates a copy of the podspec' do it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox) @subject.fetch(config.sandbox)
path = config.sandbox.specifications_root + 'Reachability.podspec' path = config.sandbox.specifications_root + 'Reachability.podspec.json'
path.should.exist? path.should.exist?
end end
...@@ -22,7 +22,7 @@ module Pod ...@@ -22,7 +22,7 @@ module Pod
podfile_path = fixture('integration/Podfile') podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path) @subject = ExternalSources.from_dependency(dependency, podfile_path)
@subject.fetch(config.sandbox) @subject.fetch(config.sandbox)
path = config.sandbox.specifications_root + 'Reachability.podspec' path = config.sandbox.specifications_root + 'Reachability.podspec.json'
path.should.exist? path.should.exist?
end end
...@@ -52,7 +52,7 @@ module Pod ...@@ -52,7 +52,7 @@ module Pod
end end
it 'marks a pod as absolute' do 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) Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec) config.sandbox.stubs(:store_podspec)
@subject.fetch(config.sandbox) @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