diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-20 03:51:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-20 03:51:15 +0000 |
commit | 4df4b48455636eb196ee4d4df2067df5c97bb021 (patch) | |
tree | 8be97e32d1c7cf30d18bda4951c20970463d2495 /tool/rbinstall.rb | |
parent | 3ea72d258975487916e46c08769dfc8ef44f1b86 (diff) | |
download | ruby-4df4b48455636eb196ee4d4df2067df5c97bb021.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/rbinstall.rb')
-rwxr-xr-x | tool/rbinstall.rb | 9 |
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 |