Commit a4108542 authored by Eloy Duran's avatar Eloy Duran

Delegate a few more Subspec attributes to the top level spec.

parent fc91353f
...@@ -53,10 +53,13 @@ module Pod ...@@ -53,10 +53,13 @@ module Pod
def summary=(summary) def summary=(summary)
@summary = summary @summary = summary
@description ||= summary
end end
attr_reader :summary attr_reader :summary
def description
@description || summary
end
def part_of=(*name_and_version_requirements) def part_of=(*name_and_version_requirements)
self.part_of_dependency = *name_and_version_requirements self.part_of_dependency = *name_and_version_requirements
@part_of.only_part_of_other_pod = true @part_of.only_part_of_other_pod = true
...@@ -111,7 +114,7 @@ module Pod ...@@ -111,7 +114,7 @@ module Pod
attr_writer :compiler_flags attr_writer :compiler_flags
def compiler_flags def compiler_flags
flags = "#{@compiler_flags} " flags = "#{@compiler_flags} "
flags << '-fobjc-arc' if @requires_arc flags << '-fobjc-arc' if requires_arc
flags flags
end end
...@@ -127,8 +130,6 @@ module Pod ...@@ -127,8 +130,6 @@ module Pod
end end
attr_reader :dependencies attr_reader :dependencies
# Subspec related
def subspec(name, &block) def subspec(name, &block)
subspec = Subspec.new(self, name, &block) subspec = Subspec.new(self, name, &block)
@subspecs << subspec @subspecs << subspec
...@@ -136,6 +137,13 @@ module Pod ...@@ -136,6 +137,13 @@ module Pod
end end
attr_reader :subspecs attr_reader :subspecs
# Not attributes
# TODO when we move to use a 'ResolveContext' this should happen there.
attr_accessor :defined_in_set
include Config::Mixin
def subspec_by_name(name) def subspec_by_name(name)
# Remove this spec's name from the beginning of the name we’re looking for # Remove this spec's name from the beginning of the name we’re looking for
# and take the first component from the remainder, which is the spec we need # and take the first component from the remainder, which is the spec we need
...@@ -149,19 +157,6 @@ module Pod ...@@ -149,19 +157,6 @@ module Pod
remainder.empty? ? subspec : subspec.subspec_by_name(name) remainder.empty? ? subspec : subspec.subspec_by_name(name)
end end
# These are attributes which are also on a Podfile
# TODO remove this, we no longer allow to install specs as Podfile
attr_accessor :generate_bridge_support
alias_method :generate_bridge_support?, :generate_bridge_support
# Not attributes
# TODO when we move to use a 'ResolveContext' this should happen there.
attr_accessor :defined_in_set
include Config::Mixin
def ==(other) def ==(other)
object_id == other.object_id || object_id == other.object_id ||
(self.class === other && (self.class === other &&
...@@ -428,6 +423,10 @@ module Pod ...@@ -428,6 +423,10 @@ module Pod
def defined_in_set def defined_in_set
top_level_parent.defined_in_set top_level_parent.defined_in_set
end end
def requires_arc
top_level_parent.requires_arc
end
end end
end end
......
...@@ -288,6 +288,7 @@ describe "A Pod::Specification subspec" do ...@@ -288,6 +288,7 @@ describe "A Pod::Specification subspec" do
s.version = '1.2.3' s.version = '1.2.3'
s.summary = 'A spec with subspecs' s.summary = 'A spec with subspecs'
s.source = { :git => '/some/url' } s.source = { :git => '/some/url' }
s.requires_arc = true
s.subspec 'FirstSubSpec' do |fss| s.subspec 'FirstSubSpec' do |fss|
fss.subspec 'SecondSubSpec' do |sss| fss.subspec 'SecondSubSpec' do |sss|
...@@ -313,10 +314,14 @@ describe "A Pod::Specification subspec" do ...@@ -313,10 +314,14 @@ describe "A Pod::Specification subspec" do
end end
it "automatically forwards undefined attributes to the top level parent" do it "automatically forwards undefined attributes to the top level parent" do
@spec.subspecs.first.summary.should == @spec.summary @spec.subspecs.first.summary.should == @spec.summary
@spec.subspecs.first.source.should == @spec.source @spec.subspecs.first.source.should == @spec.source
@spec.subspecs.first.subspecs.first.summary.should == @spec.summary @spec.subspecs.first.requires_arc.should == true
@spec.subspecs.first.subspecs.first.source.should == @spec.source @spec.subspecs.first.compiler_flags.should == ' -fobjc-arc'
@spec.subspecs.first.subspecs.first.summary.should == @spec.summary
@spec.subspecs.first.subspecs.first.source.should == @spec.source
@spec.subspecs.first.subspecs.first.requires_arc.should == true
@spec.subspecs.first.subspecs.first.compiler_flags.should == ' -fobjc-arc'
end end
it "returns subspecs by name" do it "returns subspecs by name" 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