Project

General

Profile

Actions

Bug #1163

closed

gem_prelude raise NoMethodError if require uninsalled gem with version.

Added by moro (Kyosuke MOROHASHI) almost 16 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-darwin9]
Backport:
[ruby-dev:38020]

Description

=begin
gemをKernel#gemで読み込む際、
(1)インストールされていないgemで、かつ
(2)バージョンを指定した場合に

NoMethodErrorが発生します。ここはGem::LoadErrorであるべきではないでしょうか。
ご検討お願いします。

インストールされていないgemをバージョン付きで読み込むとNoMethodError

$ ruby19 -ve "p gem 'rackie', '>= 1.0.0'"
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-darwin9]
internal:gem_prelude:249:in push_gem_version_on_load_path': undefined method <=>' for nil:NilClass (NoMethodError)
from internal:gem_prelude:14:in gem' from -e:1:in '

インストールされていないgemを読み込むとGem::LoadError

$ ruby19 -ve "p gem 'rackie'"
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-darwin9]
internal:gem_prelude:234:in push_gem_version_on_load_path': Could not find RubyGem rackie (>= 0) (Gem::LoadError) from <internal:gem_prelude>:14:in gem'
from -e:1:in `'[telperion:~/tmp/rails/actionpack]
19:47# moro[1]$

インストールされているgemをバージョン付きで読み込むとGem::LoadError

$ ruby19 -ve "p gem 'rack', '>= 1.0.0'"
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-darwin9]
/Users/moro/opt/ruby191/lib/ruby19/1.9.1/rubygems.rb:636:in report_activate_error': RubyGem version error: rack(0.9.1 not >= 1.0.0) (Gem::LoadError) from /Users/moro/opt/ruby191/lib/ruby19/1.9.1/rubygems.rb:141:in activate'
from /Users/moro/opt/ruby191/lib/ruby19/1.9.1/rubygems.rb:49:in gem' from <internal:gem_prelude>:261:in push_gem_version_on_load_path'
from internal:gem_prelude:14:in gem' from -e:1:in '[telperion:~/tmp/rails/actionpack]
=end


Files

gem_prelude_raise_right_error.patch (1.22 KB) gem_prelude_raise_right_error.patch moro (Kyosuke MOROHASHI), 02/15/2009 07:54 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0