summaryrefslogtreecommitdiff
path: root/gem_prelude.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-19 04:17:26 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-19 04:17:26 (GMT)
commit53054c0ff600d00b03cda11e3788db4b9a05d317 (patch)
treeb6dc5c2d8013ebf60e6764aebf9e3048328d306e /gem_prelude.rb
parentf3d5d707cc69c06fcbb81c65523b730c39337674 (diff)
* 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
Diffstat (limited to 'gem_prelude.rb')
-rw-r--r--gem_prelude.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/gem_prelude.rb b/gem_prelude.rb
index 553912c..4eb0e4e 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