mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
270ece8441
commit
499bf746da
4 changed files with 15 additions and 33 deletions
|
@ -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):
|
* lib/rubygems/command_manager.rb (Gem#load_and_instantiate):
|
||||||
rescue only NameError from const_get.
|
rescue only NameError from const_get.
|
||||||
|
|
|
@ -233,19 +233,11 @@ if defined?(Gem) then
|
||||||
Dir.entries(gems_directory).each do |gem_directory_name|
|
Dir.entries(gems_directory).each do |gem_directory_name|
|
||||||
next if gem_directory_name == "." || gem_directory_name == ".."
|
next if gem_directory_name == "." || gem_directory_name == ".."
|
||||||
|
|
||||||
dash = gem_directory_name.rindex("-")
|
next unless gem_name = gem_directory_name[/(.*)-(.*)/, 1]
|
||||||
next if dash.nil?
|
new_version = integers_for($2)
|
||||||
|
|
||||||
gem_name = gem_directory_name[0...dash]
|
|
||||||
current_version = GemVersions[gem_name]
|
current_version = GemVersions[gem_name]
|
||||||
new_version = integers_for(gem_directory_name[dash+1..-1])
|
|
||||||
|
|
||||||
if current_version then
|
if !current_version or (current_version <=> new_version) < 0 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
|
|
||||||
GemVersions[gem_name] = new_version
|
GemVersions[gem_name] = new_version
|
||||||
GemPaths[gem_name] = File.join(gems_directory, gem_directory_name)
|
GemPaths[gem_name] = File.join(gems_directory, gem_directory_name)
|
||||||
end
|
end
|
||||||
|
|
|
@ -325,7 +325,7 @@ class Gem::Installer
|
||||||
|
|
||||||
@spec.executables.each do |filename|
|
@spec.executables.each do |filename|
|
||||||
filename.untaint
|
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
|
mode = File.stat(bin_path).mode | 0111
|
||||||
File.chmod mode, bin_path
|
File.chmod mode, bin_path
|
||||||
|
|
||||||
|
|
|
@ -102,30 +102,17 @@ end
|
||||||
#--
|
#--
|
||||||
# This class was added to flush out problems in Rubinius' IO implementation.
|
# This class was added to flush out problems in Rubinius' IO implementation.
|
||||||
|
|
||||||
class TempIO
|
class TempIO < Tempfile
|
||||||
|
|
||||||
@@count = 0
|
|
||||||
|
|
||||||
def initialize(string = '')
|
def initialize(string = '')
|
||||||
@tempfile = Tempfile.new "TempIO-#{@@count += 1}"
|
super "TempIO"
|
||||||
@tempfile.binmode
|
binmode
|
||||||
@tempfile.write string
|
write string
|
||||||
@tempfile.rewind
|
rewind
|
||||||
end
|
|
||||||
|
|
||||||
def method_missing(meth, *args, &block)
|
|
||||||
@tempfile.send(meth, *args, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
def respond_to?(meth)
|
|
||||||
@tempfile.respond_to? meth
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def string
|
def string
|
||||||
@tempfile.flush
|
flush
|
||||||
|
Gem.read_binary path
|
||||||
Gem.read_binary @tempfile.path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue