summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtool/rbinstall.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 67a91a988c..0e2d61d52e 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -743,13 +743,10 @@ def load_gemspec(file)
file = File.realpath(file)
code = File.read(file, encoding: "utf-8:-")
code.gsub!(/`git.*?`/m, '""')
- begin
- spec = eval(code, binding, file)
- rescue SignalException, SystemExit
- raise
- rescue SyntaxError, Exception
+ spec = eval(code, binding, file)
+ unless Gem::Specification === spec
+ raise TypeError, "[#{file}] isn't a Gem::Specification (#{spec.class} instead)."
end
- raise("invalid spec in #{file}") unless spec
spec.loaded_from = file
spec
end