Commit a212f19c authored by Eloy Duran's avatar Eloy Duran

A target is exclusive if the plaform doesn't match that of the parent.

parent 9dd91b59
......@@ -10,9 +10,20 @@ module Pod
options.each { |k, v| send("#{k}=", v) }
end
def exclusive?
@exclusive
# A target is automatically `exclusive` if the `platform` does not match
# the parent's `platform`.
def exclusive
if @exclusive.nil?
if @platform.nil?
false
else
@parent.platform != @platform
end
else
@exclusive
end
end
alias_method :exclusive?, :exclusive
def link_with=(targets)
@link_with = targets.is_a?(Array) ? targets : [targets]
......
......@@ -89,6 +89,8 @@ describe "Pod::Podfile" do
target :osx_target, :platform => :osx, :link_with => 'OSXTarget' do
dependency 'ASIHTTPRequest'
target :nested_osx_target do
end
end
dependency 'ASIHTTPRequest'
......@@ -166,6 +168,11 @@ describe "Pod::Podfile" do
@podfile.target_definitions[:test].platform.should == :ios
@podfile.target_definitions[:osx_target].platform.should == :osx
end
it "autmatically marks a target as exclusive if the parent platform doesn't match" do
@podfile.target_definitions[:osx_target].should.be.exclusive
@podfile.target_definitions[:nested_osx_target].should.not.be.exclusive
end
end
describe "concerning validations" do
......
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