Commit e297e2ee authored by Francis Chong's avatar Francis Chong

Merge pull request #408 from CocoaPods/informative

Add Pod::Podfile::Informative error which show lines in Podfile
parents 0920c423 7e14b9c0
module Pod
class Podfile
class Informative < ::Pod::Informative
def podfile_line
@podfile_line ||= self.backtrace.find {|t| t =~ /Podfile/}
end
def message
if podfile_line
super + " (#{podfile_line})\n".red
else
super
end
end
end
class UserProject
include Config::Mixin
......@@ -200,7 +214,7 @@ module Pod
when :osx
target = '10.6'
else
raise Informative, "Unsupported platform: platform must be one of [:ios, :osx]"
raise ::Pod::Podfile::Informative, "Unsupported platform: platform must be one of [:ios, :osx]"
end
end
@target_definition.platform = Platform.new(name, target)
......
......@@ -19,7 +19,14 @@ describe "Pod::Podfile" do
it "raise error if unsupported platform is supplied" do
lambda {
Pod::Podfile.new { platform :iOS }
}.should.raise(StandardError, "Unsupported platform")
}.should.raise Pod::Podfile::Informative
begin
Pod::Podfile.new { platform :iOS }
rescue Pod::Podfile::Informative => e
e.stubs(:podfile_line).returns("./podfile_spec.rb:1")
e.message.should.be =~ /podfile_spec\.rb:1/
end
end
it "adds dependencies" 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