summaryrefslogtreecommitdiff
path: root/gem_prelude.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-30 08:59:16 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-30 08:59:16 (GMT)
commit499bf746da00eab7b0fc365bec0e791f1ca2b203 (patch)
tree6fe209baa581b08053a531b0bbe5ad17df8d2222 /gem_prelude.rb
parent270ece8441b26dbfbd0ca3fdcb70efec263791a8 (diff)
* gem_prelude.rb (push_all_highest_version_gems_on_load_path):
simplified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gem_prelude.rb')
-rw-r--r--gem_prelude.rb16
1 files changed, 4 insertions, 12 deletions
diff --git a/gem_prelude.rb b/gem_prelude.rb
index f83a341..fac6a38 100644
--- a/gem_prelude.rb
+++ b/gem_prelude.rb
@@ -233,19 +233,11 @@ if defined?(Gem) then
Dir.entries(gems_directory).each do |gem_directory_name|
next if gem_directory_name == "." || gem_directory_name == ".."
- dash = gem_directory_name.rindex("-")
- next if dash.nil?
-
- gem_name = gem_directory_name[0...dash]
+ next unless gem_name = gem_directory_name[/(.*)-(.*)/, 1]
+ new_version = integers_for($2)
current_version = GemVersions[gem_name]
- new_version = integers_for(gem_directory_name[dash+1..-1])
-
- if current_version then
- if (current_version <=> new_version) == -1 then
- GemVersions[gem_name] = new_version
- GemPaths[gem_name] = File.join(gems_directory, gem_directory_name)
- end
- else
+
+ if !current_version or (current_version <=> new_version) < 0 then
GemVersions[gem_name] = new_version
GemPaths[gem_name] = File.join(gems_directory, gem_directory_name)
end