Commit 87778d87 authored by Fabio Pelosin's avatar Fabio Pelosin

Small clean up.

parent ea9b1810
...@@ -52,7 +52,7 @@ module Pod ...@@ -52,7 +52,7 @@ module Pod
end end
def part_of=(value) def part_of=(value)
puts "[!] `part_of_dependency' is deprecated in #{name}" puts "[!] `part_of' is deprecated in #{name}"
end end
# Normal attributes # Normal attributes
...@@ -69,6 +69,7 @@ module Pod ...@@ -69,6 +69,7 @@ module Pod
attr_writer :summary attr_writer :summary
#TODO: handle inheritance
def available_platforms def available_platforms
@platform.nil? ? @define_for_platforms.map { |platform| Platform.new(platform, @deployment_target[platform]) } : [ platform ] @platform.nil? ? @define_for_platforms.map { |platform| Platform.new(platform, @deployment_target[platform]) } : [ platform ]
end end
...@@ -80,25 +81,25 @@ module Pod ...@@ -80,25 +81,25 @@ module Pod
# Attributes **without** multiple platform support # Attributes **without** multiple platform support
# Creates a top level attribute reader. # Creates a top level attribute reader.
def self.top_attr_reader(attr, block = nil) def self.top_attr_reader(attr, read_lambda = nil)
define_method(attr) do define_method(attr) do
ivar = instance_variable_get("@#{attr}") ivar = instance_variable_get("@#{attr}")
@parent ? top_level_parent.send(attr) : ( block ? block.call(self, ivar) : ivar ) @parent ? top_level_parent.send(attr) : ( read_lambda ? read_lambda.call(self, ivar) : ivar )
end end
end end
# Creates a top level attribute writer. A lambda can be passed to initialize the value. # Creates a top level attribute writer. A lambda can be passed to initialize the value.
def self.top_attr_writer(attr, block = nil) def self.top_attr_writer(attr, init_lambda = nil)
raise Informative "Can't set #{attr} for subspecs" if @parent raise Informative "Can't set #{attr} for subspecs" if @parent
define_method("#{attr}=") do |value| define_method("#{attr}=") do |value|
instance_variable_set("@#{attr}", block ? block.call(value) : value); instance_variable_set("@#{attr}", init_lambda ? init_lambda.call(value) : value);
end end
end end
# Creates a top level attribute accessor. A lambda can be passed to initialize the value in the attribute writer. # Creates a top level attribute accessor. A lambda can be passed to initialize the value in the attribute writer.
def self.top_attr_accessor(attr, block = nil) def self.top_attr_accessor(attr, writer_labmda = nil)
top_attr_reader attr top_attr_reader attr
top_attr_writer attr, block top_attr_writer attr, writer_labmda
end end
top_attr_accessor :homepage top_attr_accessor :homepage
...@@ -134,12 +135,6 @@ module Pod ...@@ -134,12 +135,6 @@ module Pod
authors || list.first authors || list.first
end end
# # TODO: move logic to compiler_flags
# def requires_arc=(requires_arc)
# self.compiler_flags = '-fobjc-arc' if requires_arc
# @requires_arc = requires_arc
# end
### Attributes **with** multiple platform support ### Attributes **with** multiple platform support
class PlatformProxy class PlatformProxy
...@@ -194,22 +189,26 @@ module Pod ...@@ -194,22 +189,26 @@ module Pod
@xcconfig = { :ios => Xcodeproj::Config.new, :osx => Xcodeproj::Config.new } @xcconfig = { :ios => Xcodeproj::Config.new, :osx => Xcodeproj::Config.new }
end end
pltf_chained_attr_reader :source_files pltf_chained_attr_reader :source_files
platform_attr_writer :source_files, lambda {|value, current| pattern_list(value) } platform_attr_writer :source_files,
lambda {|value, current| pattern_list(value) }
pltf_chained_attr_reader :resources pltf_chained_attr_reader :resources
platform_attr_writer :resources, lambda {|value, current| pattern_list(value) } platform_attr_writer :resources,
alias_method :resource=, :resources= lambda {|value, current| pattern_list(value) }
alias_method :resource=, :resources=
# frameworks are chained by the xcofing attr_reader # frameworks are chained by the xcofing attr_reader
platform_attr_reader :frameworks platform_attr_reader :frameworks
platform_attr_writer :frameworks, lambda {|value, current| current << value } platform_attr_writer :frameworks,
alias_method :framework=, :frameworks= lambda {|value, current| current << value }
alias_method :framework=, :frameworks=
# libraries are chained by the xcofing attr_reader # libraries are chained by the xcofing attr_reader
platform_attr_reader :libraries platform_attr_reader :libraries
platform_attr_writer :libraries, lambda {|value, current| current << value } platform_attr_writer :libraries,
alias_method :library=, :libraries= lambda {|value, current| current << value }
alias_method :library=, :libraries=
def xcconfig def xcconfig
result = {} result = {}
...@@ -263,6 +262,7 @@ module Pod ...@@ -263,6 +262,7 @@ module Pod
result result
end end
# TODO: make top level?
def deployment_target=(version) def deployment_target=(version)
raise Informative, "The deployment target must be defined per platform like s.ios.deployment_target = '5.0'" unless @define_for_platforms.count == 1 raise Informative, "The deployment target must be defined per platform like s.ios.deployment_target = '5.0'" unless @define_for_platforms.count == 1
@deployment_target[@define_for_platforms.first] = version @deployment_target[@define_for_platforms.first] = version
......
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