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