[前][次][番号順一覧][スレッド一覧]

ruby-changes:54238

From: nobu <ko1@a...>
Date: Thu, 20 Dec 2018 12:51:19 +0900 (JST)
Subject: [ruby-changes:54238] nobu:r66460 (trunk): rbinstall.rb: syntax error in gemspec

nobu	2018-12-20 12:51:15 +0900 (Thu, 20 Dec 2018)

  New Revision: 66460

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66460

  Log:
    rbinstall.rb: syntax error in gemspec
    
    * tool/rbinstall.rb (load_gemspec): do not hide syntax errors in
      a gemspec file.  check if the result instead.

  Modified files:
    trunk/tool/rbinstall.rb
Index: tool/rbinstall.rb
===================================================================
--- tool/rbinstall.rb	(revision 66459)
+++ tool/rbinstall.rb	(revision 66460)
@@ -743,13 +743,10 @@ def load_gemspec(file) https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L743
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]