Skip to content

Commit

Permalink
Merge pull request #403 from siuying/validate_platform
Browse files Browse the repository at this point in the history
raise informative error message when user supplied invalid platform
  • Loading branch information
siuying committed Jul 15, 2012
2 parents 09ebfb1 + 695509f commit cae31b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/cocoapods/podfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def platform(name, target = nil)
target = '4.3'
when :osx
target = '10.6'
else
raise Informative, "Unsupported platform: platform must be one of [:ios, :osx]"
end
end
@target_definition.platform = Platform.new(name, target)
Expand Down
6 changes: 6 additions & 0 deletions spec/unit/podfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
podfile.target_definitions[:default].platform.deployment_target.should == Pod::Version.new('4.3')
end

it "raise error if unsupported platform is supplied" do
lambda {
Pod::Podfile.new { platform :iOS }
}.should.raise(StandardError, "Unsupported platform")
end

it "adds dependencies" do
podfile = Pod::Podfile.new { pod 'ASIHTTPRequest'; pod 'SSZipArchive', '>= 0.1' }
podfile.dependencies.size.should == 2
Expand Down

0 comments on commit cae31b0

Please sign in to comment.