* 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
This commit is contained in:
nobu 2009-12-30 08:59:16 +00:00
Родитель 270ece8441
Коммит 499bf746da
4 изменённых файлов: 15 добавлений и 33 удалений

Просмотреть файл

@ -1,4 +1,7 @@
Wed Dec 30 17:49:47 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
Wed Dec 30 17:59:14 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gem_prelude.rb (push_all_highest_version_gems_on_load_path):
simplified.
* lib/rubygems/command_manager.rb (Gem#load_and_instantiate):
rescue only NameError from const_get.

Просмотреть файл

@ -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

Просмотреть файл

@ -325,7 +325,7 @@ class Gem::Installer
@spec.executables.each do |filename|
filename.untaint
bin_path = File.expand_path File.join(@gem_dir, @spec.bindir, filename)
bin_path = File.expand_path("#{@spec.bindir}/#{filename}", @gem_dir)
mode = File.stat(bin_path).mode | 0111
File.chmod mode, bin_path

Просмотреть файл

@ -102,30 +102,17 @@ end
#--
# This class was added to flush out problems in Rubinius' IO implementation.
class TempIO
@@count = 0
class TempIO < Tempfile
def initialize(string = '')
@tempfile = Tempfile.new "TempIO-#{@@count += 1}"
@tempfile.binmode
@tempfile.write string
@tempfile.rewind
end
def method_missing(meth, *args, &block)
@tempfile.send(meth, *args, &block)
end
def respond_to?(meth)
@tempfile.respond_to? meth
super "TempIO"
binmode
write string
rewind
end
def string
@tempfile.flush
Gem.read_binary @tempfile.path
end
flush
Gem.read_binary path
end
end