diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-04-19 04:17:26 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-04-19 04:17:26 +0000 |
commit | 53054c0ff600d00b03cda11e3788db4b9a05d317 (patch) | |
tree | b6dc5c2d8013ebf60e6764aebf9e3048328d306e | |
parent | f3d5d707cc69c06fcbb81c65523b730c39337674 (diff) | |
download | ruby-53054c0ff600d00b03cda11e3788db4b9a05d317.tar.gz |
* gem_prelude.rb (Gem::QuickLoader#push_gem_version_on_load_path):
check for requirement if the gem is installed. a patch from
Kyosuke MOROHASHI at [ruby-dev:38020].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gem_prelude.rb | 20 |
2 files changed, 17 insertions, 9 deletions
@@ -1,3 +1,9 @@ +Sun Apr 19 13:17:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * gem_prelude.rb (Gem::QuickLoader#push_gem_version_on_load_path): + check for requirement if the gem is installed. a patch from + Kyosuke MOROHASHI at [ruby-dev:38020]. + Sun Apr 19 01:39:17 2009 Tanaka Akira <akr@fsij.org> * process.c (proc_seteuid_m): defined to use rb_f_notimplement if not diff --git a/gem_prelude.rb b/gem_prelude.rb index 553912c83d..4eb0e4e304 100644 --- a/gem_prelude.rb +++ b/gem_prelude.rb @@ -245,15 +245,17 @@ if defined?(Gem) then requirement, version = version_requirements[0].split requirement.strip! - if requirement == ">" || requirement == ">=" - if (GemVersions[gem_name] <=> Gem.calculate_integers_for_gem_version(version)) >= 0 - return false - end - elsif requirement == "~>" - loaded_version = GemVersions[gem_name] - required_version = Gem.calculate_integers_for_gem_version(version) - if loaded_version && (loaded_version[0] == required_version[0]) - return false + if loaded_version = GemVersions[gem_name] + case requirement + when ">", ">=" + if (loaded_version <=> Gem.calculate_integers_for_gem_version(version)) >= 0 + return false + end + when "~>" + required_version = Gem.calculate_integers_for_gem_version(version) + if (loaded_version[0] == required_version[0]) + return false + end end end |