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

[Validator] Ensure that the parameter source URLs are used in the Podfile

Didn't work before because `instance_eval` changes the scope of the block
parent ecbae47b
...@@ -416,12 +416,10 @@ module Pod ...@@ -416,12 +416,10 @@ module Pod
# !@group Helpers # !@group Helpers
# @return [Array<Source>] an array of sources used to create the # @return [Array<String>] an array of source URLs used to create the
# {Podfile} used in the linting process # {Podfile} used in the linting process
# #
def sources attr_reader :source_urls
@sources ||= @source_urls.map { |url| SourcesManager.find_or_create_source_with_url(url) }
end
# @return [Podfile] a podfile that requires the specification on the # @return [Podfile] a podfile that requires the specification on the
# current platform. # current platform.
...@@ -433,8 +431,9 @@ module Pod ...@@ -433,8 +431,9 @@ module Pod
name = subspec_name ? subspec_name : spec.name name = subspec_name ? subspec_name : spec.name
podspec = file.realpath podspec = file.realpath
local = local? local = local?
urls = source_urls
podfile = Pod::Podfile.new do podfile = Pod::Podfile.new do
sources.each { |s| source(s.url) } urls.each { |u| source(u) }
platform(platform_name, deployment_target) platform(platform_name, deployment_target)
if local if local
pod name, :path => podspec.dirname.to_s pod name, :path => podspec.dirname.to_s
......
...@@ -291,6 +291,14 @@ module Pod ...@@ -291,6 +291,14 @@ module Pod
deployment_target.to_s.should == '5.0' deployment_target.to_s.should == '5.0'
end end
it 'repects the source_urls parameter' do
sources = %w(https://github.com/CocoaPods/Specs.git https://github.com/artsy/Specs.git)
sut = Validator.new(podspec_path, sources)
sut.stubs(:validate_url)
podfile = sut.send(:podfile_from_spec, :ios, '5.0')
podfile.sources.should == sources
end
it 'uses xcodebuild to generate notes and warnings' do it 'uses xcodebuild to generate notes and warnings' do
sut = Validator.new(podspec_path, SourcesManager.master.map(&:url)) sut = Validator.new(podspec_path, SourcesManager.master.map(&:url))
sut.stubs(:check_file_patterns) sut.stubs(:check_file_patterns)
......
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