Commit 290eca16 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4322 from CocoaPods/seg-podspec-finder-no-recurse

[PodspecFinder] Only consider toplevel podspecs
parents 17fcb6d3 7ce687b7
......@@ -68,6 +68,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[#3644](https://github.com/CocoaPods/CocoaPods/issues/3644)
[#4393](https://github.com/CocoaPods/CocoaPods/issues/4393)
* Only the root directory of externally-sourced pods will be searched for
podspecs.
[Samuel Giddins](https://github.com/segiddins)
[#3683](https://github.com/CocoaPods/CocoaPods/issues/3683)
## 0.39.0 (2015-10-09)
......
......@@ -10,7 +10,7 @@ module Pod
def podspecs
return @specs_by_name if @specs_by_name
@specs_by_name = {}
spec_files = Pathname.glob(root + '{,*,*/*}.podspec{,.json}')
spec_files = Pathname.glob(root + '{,*}.podspec{,.json}')
spec_files.sort_by { |p| -p.to_path.split(File::SEPARATOR).size }.each do |file|
begin
spec = Specification.from_file(file)
......
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Sandbox::PodspecFinder do
before do
@root = Pathname(Dir.mktmpdir)
@finder = Sandbox::PodspecFinder.new(@root)
end
after do
@root.rmtree
end
it 'returns an empty hash when no podspecs are found' do
@finder.podspecs.should.be.empty
end
it "warns when a found podspec can't be parsed" do
@root.+('RestKit.podspec.json').open('w') { |f| f << '{]' }
@finder.podspecs.should.be.empty
UI.warnings.should.include "Unable to load a podspec from `RestKit.podspec.json`, skipping:\n\n"
end
it 'ignores podspecs not in the root' do
path = @root + 'Dir/RestKit.podspec.json'
path.parent.mkpath
path.open('w') { |f| f << '{"name":"RestKit"}' }
@finder.podspecs.should.be.empty
end
it 'groups found podspecs by name' do
@root.+('Realm.podspec.json').open('w') { |f| f << '{"name":"Realm"}' }
@root.+('RealmSwift.podspec').open('w') { |f| f << 'Pod::Specification.new { |s| s.name = "RealmSwift" }' }
@finder.podspecs.should == {
'Realm' => Pod::Specification.new { |s| s.name = 'Realm' },
'RealmSwift' => Pod::Specification.new { |s| s.name = 'RealmSwift' },
}
end
it 'caches the podspecs' do
@finder.podspecs
Pathname.expects(:glob).never
@finder.podspecs
end
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