Commit 8553b9eb authored by Fabio Pelosin's avatar Fabio Pelosin

[Specification#deployment_target=] Switch to Pod::Version

parent b86625e6
...@@ -535,14 +535,14 @@ Pod::Spec.new do |s| ...@@ -535,14 +535,14 @@ Pod::Spec.new do |s|
# If this Pod runs only on iOS or OS X, then specify the platfrom and # If this Pod runs only on iOS or OS X, then specify the platfrom and
# the deployment target. # the deployment target.
# #
# s.platform = :ios, '>= 5.0' # s.platform = :ios, '5.0'
# s.platform = :ios # s.platform = :ios
# If this Pod runs on boths platforms, then specify the deployment # If this Pod runs on boths platforms, then specify the deployment
# targets. # targets.
# #
# s.ios.deployment_target = '>= 5.0' # s.ios.deployment_target = '5.0'
# s.osx.deployment_target = '>= 10.7' # s.osx.deployment_target = '10.7'
# A list of resources included with the Pod. These are copied into the # A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script. # target bundle with a build phase script.
......
...@@ -115,16 +115,14 @@ module Pod ...@@ -115,16 +115,14 @@ module Pod
end end
def platform=(platform) def platform=(platform)
if platform.class == Array @platform = Platform.new(*platform)
name = platform[0]
@deployment_target[name] = Gem::Requirement.new(platform[1])
else
name = platform
end
@platform = Platform.new(name)
end end
attr_reader :platform attr_reader :platform
def platforms
@platform.nil? ? @define_for_platforms.map { |platfrom| Platform.new(platfrom, @deployment_target[platfrom]) } : [platform]
end
def requires_arc=(requires_arc) def requires_arc=(requires_arc)
self.compiler_flags = '-fobjc-arc' if requires_arc self.compiler_flags = '-fobjc-arc' if requires_arc
@requires_arc = requires_arc @requires_arc = requires_arc
...@@ -181,12 +179,10 @@ module Pod ...@@ -181,12 +179,10 @@ module Pod
end end
attr_reader :source_files attr_reader :source_files
def deployment_target=(requirement) def deployment_target=(version)
@define_for_platforms.each do |platform| 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[platform] = Gem::Requirement.new(requirement) @deployment_target[@define_for_platforms.first] = version
end
end end
attr_reader :deployment_target
def resources=(patterns) def resources=(patterns)
@define_for_platforms.each do |platform| @define_for_platforms.each do |platform|
......
...@@ -154,6 +154,19 @@ describe "A Pod::Specification, in general," do ...@@ -154,6 +154,19 @@ describe "A Pod::Specification, in general," do
@spec.platform.should == :ios @spec.platform.should == :ios
end end
it "returns the platform and the deployment target" do
@spec.platform = :ios, '4.0'
@spec.platform.should == :ios
@spec.platform.deployment_target.should == Pod::Version.new('4.0')
end
it "returns the platfroms for which the pod is supported" do
@spec.platform = :ios, '4.0'
@spec.platforms.count.should == 1
@spec.platforms.first.should == :ios
@spec.platforms.first.deployment_target.should == Pod::Version.new('4.0')
end
it "returns the license of the Pod" do it "returns the license of the Pod" do
@spec.license = { @spec.license = {
:type => 'MIT', :type => 'MIT',
...@@ -168,7 +181,7 @@ describe "A Pod::Specification, in general," do ...@@ -168,7 +181,7 @@ describe "A Pod::Specification, in general," do
:text => 'Permission is hereby granted ...' :text => 'Permission is hereby granted ...'
} }
end end
it "returns the license of the Pod specified in the old format" do it "returns the license of the Pod specified in the old format" do
@spec.license = 'MIT' @spec.license = 'MIT'
@spec.license.should == { @spec.license.should == {
...@@ -183,7 +196,7 @@ describe "A Pod::Specification, in general," do ...@@ -183,7 +196,7 @@ describe "A Pod::Specification, in general," do
'--project-company', '"Company Name"', '--project-company', '"Company Name"',
'--company-id', 'com.company', '--company-id', 'com.company',
'--ignore', 'Common', '--ignore', 'Common',
'--ignore', '.m'] '--ignore', '.m']
} }
@spec.documentation[:html].should == 'http://EXAMPLE/#{@name}/documentation' @spec.documentation[:html].should == 'http://EXAMPLE/#{@name}/documentation'
@spec.documentation[:appledoc].should == ['--project-name', '#{@name}', @spec.documentation[:appledoc].should == ['--project-name', '#{@name}',
...@@ -288,11 +301,11 @@ describe "A Pod::Specification with :local source" do ...@@ -288,11 +301,11 @@ describe "A Pod::Specification with :local source" do
s.source_files = "." s.source_files = "."
end end
end end
it "is marked as local" do it "is marked as local" do
@spec.should.be.local @spec.should.be.local
end end
it "it returns the expanded local path" do it "it returns the expanded local path" do
@spec.local_path.should == fixture("integration/JSONKit") @spec.local_path.should == fixture("integration/JSONKit")
end end
...@@ -364,6 +377,8 @@ describe "A Pod::Specification, concerning its attributes that support different ...@@ -364,6 +377,8 @@ describe "A Pod::Specification, concerning its attributes that support different
s.ios.dependency 'JSONKit' s.ios.dependency 'JSONKit'
s.osx.dependency 'SSZipArchive' s.osx.dependency 'SSZipArchive'
s.ios.deployment_target = '4.0'
end end
end end
...@@ -382,6 +397,12 @@ describe "A Pod::Specification, concerning its attributes that support different ...@@ -382,6 +397,12 @@ describe "A Pod::Specification, concerning its attributes that support different
} }
end end
it "returns the list of the supported platfroms and deployment targets" do
@spec.platforms.count.should == 2
@spec.platforms.should.include? Pod::Platform.new(:osx)
@spec.platforms.should.include? Pod::Platform.new(:ios, '4.0')
end
it "returns the same list of compiler flags for each platform" do it "returns the same list of compiler flags for each platform" do
@spec.compiler_flags.should == { @spec.compiler_flags.should == {
:ios => ' -Wdeprecated-implementations -fobjc-arc', :ios => ' -Wdeprecated-implementations -fobjc-arc',
......
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