From e269b2c55ca55409442ac2f8d3198512aa559119 Mon Sep 17 00:00:00 2001 From: Taras Kalapun Date: Thu, 4 Oct 2012 17:44:49 +0200 Subject: [PATCH] Adding error handling for incorrect Podfile syntax --- lib/cocoapods/podfile.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cocoapods/podfile.rb b/lib/cocoapods/podfile.rb index 654544e0d4..5e9258ff1c 100644 --- a/lib/cocoapods/podfile.rb +++ b/lib/cocoapods/podfile.rb @@ -177,7 +177,11 @@ def self.from_file(path) string = File.open(path, 'r:utf-8') { |f| f.read } # TODO: work around for Rubinius incomplete encoding in 1.9 mode string.encode!('UTF-8') if string.respond_to?(:encoding) && string.encoding.name != "UTF-8" - eval(string, nil, path.to_s) + begin + eval(string, nil, path.to_s) + rescue Exception => e + raise Informative, "Podfile syntax error: #{e.inspect}" + end end podfile.defined_in_file = path podfile.validate!