Commit 335f4a20 authored by Marius Rackwitz's avatar Marius Rackwitz

[PodTarget] Require target_definitions on init

parent 6b697111
...@@ -40,6 +40,7 @@ module Pod ...@@ -40,6 +40,7 @@ module Pod
# #
def initialize(specs, target_definitions, sandbox, scoped = false) def initialize(specs, target_definitions, sandbox, scoped = false)
raise "Can't initialize a PodTarget without specs!" if specs.nil? || specs.empty? raise "Can't initialize a PodTarget without specs!" if specs.nil? || specs.empty?
raise "Can't initialize a PodTarget without TargetDefinition!" if target_definitions.nil? || target_definitions.empty?
@specs = specs @specs = specs
@target_definitions = target_definitions @target_definitions = target_definitions
@sandbox = sandbox @sandbox = sandbox
......
...@@ -77,9 +77,9 @@ module Pod ...@@ -77,9 +77,9 @@ module Pod
describe 'Private Helpers' do describe 'Private Helpers' do
describe '#file_accessors' do describe '#file_accessors' do
it 'returns the file accessors' do it 'returns the file accessors' do
pod_target_1 = PodTarget.new([], nil, config.sandbox) pod_target_1 = PodTarget.new([stub('Spec')], [stub('TargetDefinition')], config.sandbox)
pod_target_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')] pod_target_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
pod_target_2 = PodTarget.new([], nil, config.sandbox) pod_target_2 = PodTarget.new([stub('Spec')], [stub('TargetDefinition')], config.sandbox)
pod_target_2.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')] pod_target_2.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
installer = Installer::FileReferencesInstaller.new(config.sandbox, [pod_target_1, pod_target_2], @project) installer = Installer::FileReferencesInstaller.new(config.sandbox, [pod_target_1, pod_target_2], @project)
roots = installer.send(:file_accessors).map { |fa| fa.path_list.root } roots = installer.send(:file_accessors).map { |fa| fa.path_list.root }
...@@ -87,7 +87,7 @@ module Pod ...@@ -87,7 +87,7 @@ module Pod
end end
it 'handles libraries empty libraries without file accessors' do it 'handles libraries empty libraries without file accessors' do
pod_target_1 = PodTarget.new([], nil, config.sandbox) pod_target_1 = PodTarget.new([stub('Spec')], [stub('TargetDefinition')], config.sandbox)
pod_target_1.file_accessors = [] pod_target_1.file_accessors = []
installer = Installer::FileReferencesInstaller.new(config.sandbox, [pod_target_1], @project) installer = Installer::FileReferencesInstaller.new(config.sandbox, [pod_target_1], @project)
installer.send(:file_accessors).should == [] installer.send(:file_accessors).should == []
......
...@@ -306,7 +306,7 @@ module Pod ...@@ -306,7 +306,7 @@ module Pod
@analysis_result = Installer::Analyzer::AnalysisResult.new @analysis_result = Installer::Analyzer::AnalysisResult.new
@analysis_result.specifications = [] @analysis_result.specifications = []
@analysis_result.sandbox_state = Installer::Analyzer::SpecsState.new @analysis_result.sandbox_state = Installer::Analyzer::SpecsState.new
@pod_targets = [PodTarget.new([], nil, config.sandbox)] @pod_targets = [PodTarget.new([stub('Spec')], [stub('TargetDefinition')], config.sandbox)]
@installer.stubs(:analysis_result).returns(@analysis_result) @installer.stubs(:analysis_result).returns(@analysis_result)
@installer.stubs(:pod_targets).returns(@pod_targets) @installer.stubs(:pod_targets).returns(@pod_targets)
end end
...@@ -364,7 +364,7 @@ module Pod ...@@ -364,7 +364,7 @@ module Pod
it 'correctly configures the Pod source installer' do it 'correctly configures the Pod source installer' do
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
pod_target = PodTarget.new([spec], nil, config.sandbox) pod_target = PodTarget.new([spec], [stub('TargetDefinition')], config.sandbox)
pod_target.stubs(:platform).returns(:ios) pod_target.stubs(:platform).returns(:ios)
@installer.stubs(:pod_targets).returns([pod_target]) @installer.stubs(:pod_targets).returns([pod_target])
@installer.instance_variable_set(:@installed_specs, []) @installer.instance_variable_set(:@installed_specs, [])
...@@ -374,7 +374,7 @@ module Pod ...@@ -374,7 +374,7 @@ module Pod
it 'maintains the list of the installed specs' do it 'maintains the list of the installed specs' do
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
pod_target = PodTarget.new([spec], nil, config.sandbox) pod_target = PodTarget.new([spec], [stub('TargetDefinition')], config.sandbox)
pod_target.stubs(:platform).returns(:ios) pod_target.stubs(:platform).returns(:ios)
@installer.stubs(:pod_targets).returns([pod_target, pod_target]) @installer.stubs(:pod_targets).returns([pod_target, pod_target])
@installer.instance_variable_set(:@installed_specs, []) @installer.instance_variable_set(:@installed_specs, [])
...@@ -463,9 +463,8 @@ module Pod ...@@ -463,9 +463,8 @@ module Pod
end end
it 'sets the deployment target for the whole project' do it 'sets the deployment target for the whole project' do
spec = fixture_spec('banana-lib/BananaLib.podspec') pod_target_ios = PodTarget.new([stub('Spec')], [stub('TargetDefinition')], config.sandbox)
pod_target_ios = PodTarget.new([spec], nil, config.sandbox) pod_target_osx = PodTarget.new([stub('Spec')], [stub('TargetDefinition')], config.sandbox)
pod_target_osx = PodTarget.new([spec], nil, config.sandbox)
pod_target_ios.stubs(:platform).returns(Platform.new(:ios, '6.0')) pod_target_ios.stubs(:platform).returns(Platform.new(:ios, '6.0'))
pod_target_osx.stubs(:platform).returns(Platform.new(:osx, '10.8')) pod_target_osx.stubs(:platform).returns(Platform.new(:osx, '10.8'))
aggregate_target_ios = AggregateTarget.new(nil, config.sandbox) aggregate_target_ios = AggregateTarget.new(nil, config.sandbox)
...@@ -621,7 +620,7 @@ module Pod ...@@ -621,7 +620,7 @@ module Pod
it 'shares schemes of development pods' do it 'shares schemes of development pods' do
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile) target_definition = Podfile::TargetDefinition.new(:default, @installer.podfile)
pod_target = PodTarget.new([spec], target_definition, config.sandbox) pod_target = PodTarget.new([spec], [target_definition], config.sandbox)
@installer.pods_project.stubs(:targets).returns([pod_target]) @installer.pods_project.stubs(:targets).returns([pod_target])
@installer.sandbox.stubs(:development_pods).returns('BananaLib' => nil) @installer.sandbox.stubs(:development_pods).returns('BananaLib' => nil)
......
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