1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix RubyGems for 1.9, r1780

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2008-06-17 23:59:31 +00:00
parent 9d4f37f51f
commit 215fbc639f
10 changed files with 86 additions and 90 deletions

View file

@ -1,3 +1,10 @@
Wed Jun 18 08:58:16 2008 Eric Hodel <drbrain@segment7.net>
* lib/rubygems/*: Fix errors for 1.9.
* gem_prelude.rb: Only remove methods from gem_prelude.rb when
loading real RubyGems.
Wed Jun 18 07:03:30 2008 Eric Hodel <drbrain@egment7.net>
* lib/rubygems/*: Update to RubyGems r1778 (pre 1.2).

View file

@ -1,9 +1,5 @@
# depends on: array.rb dir.rb env.rb file.rb hash.rb module.rb regexp.rb
# empty gem_prelude.rb
#
# p defined?(Gem)
if defined?(Gem) then
module Kernel
@ -28,73 +24,69 @@ if defined?(Gem) then
:ruby_install_name => RbConfig::CONFIG["ruby_install_name"]
}
class << self
def default_dir
if defined? RUBY_FRAMEWORK_VERSION
return File.join(File.dirname(ConfigMap[:sitedir]), "Gems")
else
File.join(ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version])
end
def self.default_dir
if defined? RUBY_FRAMEWORK_VERSION
return File.join(File.dirname(ConfigMap[:sitedir]), "Gems")
else
File.join(ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version])
end
def dir
@gem_home ||= nil
set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
@gem_home
end
def path
@gem_path ||= nil
unless @gem_path
paths = [ENV['GEM_PATH']]
paths << APPLE_GEM_HOME if defined? APPLE_GEM_HOME
set_paths(paths.compact.join(File::PATH_SEPARATOR))
end
@gem_path
end
# Set the Gem home directory (as reported by +dir+).
def set_home(home)
@gem_home = home
ensure_gem_subdirectories(@gem_home)
end
def set_paths(gpaths)
if gpaths
@gem_path = gpaths.split(File::PATH_SEPARATOR)
@gem_path << Gem.dir
else
@gem_path = [Gem.dir]
end
@gem_path.uniq!
@gem_path.each do |gp| ensure_gem_subdirectories(gp) end
end
def ensure_gem_subdirectories(path)
end
end
def self.dir
@gem_home ||= nil
set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
@gem_home
end
def self.path
@gem_path ||= nil
unless @gem_path
paths = [ENV['GEM_PATH']]
paths << APPLE_GEM_HOME if defined? APPLE_GEM_HOME
set_paths(paths.compact.join(File::PATH_SEPARATOR))
end
@gem_path
end
# Set the Gem home directory (as reported by +dir+).
def self.set_home(home)
@gem_home = home
ensure_gem_subdirectories(@gem_home)
end
def self.set_paths(gpaths)
if gpaths
@gem_path = gpaths.split(File::PATH_SEPARATOR)
@gem_path << Gem.dir
else
@gem_path = [Gem.dir]
end
@gem_path.uniq!
@gem_path.each do |gp| ensure_gem_subdirectories(gp) end
end
def self.ensure_gem_subdirectories(path)
end
GEM_PRELUDE_METHODS = Gem.methods(false)
module QuickLoader
class << self
def load_full_rubygems_library
class << Gem
Gem.methods(false).each do |method_name|
undef_method method_name
end
def self.load_full_rubygems_library
class << Gem
Gem::GEM_PRELUDE_METHODS.each do |method_name|
undef_method method_name
end
Kernel.module_eval do
undef_method :gem if method_defined? :gem
end
$".delete File.join(Gem::ConfigMap[:libdir], 'ruby',
Gem::ConfigMap[:ruby_version], 'rubygems.rb')
require 'rubygems'
end
Kernel.module_eval do
undef_method :gem if method_defined? :gem
end
$".delete File.join(Gem::ConfigMap[:libdir], 'ruby',
Gem::ConfigMap[:ruby_version], 'rubygems.rb')
require 'rubygems'
end
GemPaths = {}

View file

@ -50,7 +50,11 @@ class Gem::Commands::InstallCommand < Gem::Command
installed_gems = []
ENV['GEM_PATH'] = options[:install_dir] # HACK what does this do?
if options[:install_dir].nil? and RUBY_VERSION > '1.9' then
ENV.delete 'GEM_PATH'
else
ENV['GEM_PATH'] = options[:install_dir] # HACK what does this do?
end
install_options = {
:env_shebang => options[:env_shebang],

View file

@ -131,18 +131,18 @@ class Gem::Commands::QueryCommand < Gem::Command
versions[spec_tuple.first] << [spec_tuple, source_uri]
end
versions = versions.sort_by do |(name,),|
versions = versions.sort_by do |(name,_),_|
name.downcase
end
versions.each do |gem_name, matching_tuples|
matching_tuples = matching_tuples.sort_by do |(name, version,),|
matching_tuples = matching_tuples.sort_by do |(name, version,_),_|
version
end.reverse
seen = {}
matching_tuples.delete_if do |(name, version,),|
matching_tuples.delete_if do |(name, version,_),_|
if seen[version] then
true
else
@ -154,7 +154,7 @@ class Gem::Commands::QueryCommand < Gem::Command
entry = gem_name.dup
if options[:versions] then
versions = matching_tuples.map { |(name, version,),| version }.uniq
versions = matching_tuples.map { |(name, version,_),_| version }.uniq
entry << " (#{versions.join ', '})"
end

View file

@ -111,10 +111,10 @@ Will cause RubyGems to revert to legacy indexes, degrading performance.
fetcher = Gem::SpecFetcher.fetcher
if fetcher.legacy_repos.empty? then
Gem.sources.each do |source_uri|
source_uri = URI.parse source_uri
fetcher.load_specs source_uri, 'specs'
fetcher.load_specs source_uri, 'latest_specs'
Gem.sources.each do |update_uri|
update_uri = URI.parse update_uri
fetcher.load_specs update_uri, 'specs'
fetcher.load_specs update_uri, 'latest_specs'
end
else
Gem::SourceInfoCache.cache true

View file

@ -133,7 +133,7 @@ class Gem::DependencyInstaller
deps.each do |dep|
results = find_gems_with_sources(dep).reverse
results.reject! do |spec,|
results.reject! do
@source_index.any? do |_, installed_spec|
dep.name == installed_spec.name and
dep.version_requirements.satisfied_by? installed_spec.version

View file

@ -2,5 +2,5 @@
# This file is auto-generated by build scripts.
# See: rake update_version
module Gem
RubyGemsVersion = '1.1.1.1778'
RubyGemsVersion = '1.1.1'
end

View file

@ -300,14 +300,12 @@ class Gem::SourceIndex
outdateds = []
latest_specs.each do |local|
name = local.name
dependency = Gem::Dependency.new name, ">= #{local.version}"
dependency = Gem::Dependency.new local.name, ">= #{local.version}"
begin
fetcher = Gem::SpecFetcher.fetcher
remotes = fetcher.find_matching dependency
remotes = remotes.map { |(name, version,),| version }
remotes = remotes.map { |(name, version,_),_| version }
rescue Gem::RemoteFetcher::FetchError => e
raise unless fetcher.warn_legacy e do
require 'rubygems/source_info_cache'
@ -320,7 +318,7 @@ class Gem::SourceIndex
latest = remotes.sort.last
outdateds << name if latest and local.version < latest
outdateds << local.name if latest and local.version < latest
end
outdateds

View file

@ -42,7 +42,7 @@ module Gem
#
# gem_path:: [String] Path to gem file
def verify_gem_file(gem_path)
File.open gem_path, 'rb' do |file|
open gem_path, Gem.binary_mode do |file|
gem_data = file.read
verify_gem gem_data
end
@ -91,7 +91,7 @@ module Gem
begin
verify_gem_file(gem_path)
File.open(gem_path, 'rb') do |file|
open gem_path, Gem.binary_mode do |file|
format = Gem::Format.from_file_by_path(gem_path)
format.file_entries.each do |entry, data|
# Found this file. Delete it from list
@ -99,7 +99,7 @@ module Gem
next unless data # HACK `gem check -a mkrf`
File.open(File.join(gem_directory, entry['path']), 'rb') do |f|
open File.join(gem_directory, entry['path']), Gem.binary_mode do |f|
unless Gem::MD5.hexdigest(f.read).to_s ==
Gem::MD5.hexdigest(data).to_s then
errors[gem_name] << ErrorData.new(entry['path'], "installed file doesn't match original from gem")

View file

@ -128,13 +128,8 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
assert_equal '', @ui.output
expected = <<-EOF
WARNING: compile error
#{spec_file}:1: syntax error, unexpected $end
WARNING: 1 +
EOF
assert_equal expected, @ui.error
assert_match(/syntax error/, @ui.error)
assert_match(/1 \+/, @ui.error)
end
def test_self_load_specification_system_exit