[macruby-changes] [5167] MacRuby/trunk/lib
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jan 14 19:58:03 PST 2011
Revision: 5167
http://trac.macosforge.org/projects/ruby/changeset/5167
Author: lsansonetti at apple.com
Date: 2011-01-14 19:57:58 -0800 (Fri, 14 Jan 2011)
Log Message:
-----------
really upgrade to rubygems 1.4.2 (note to myself: never trust git again)
Modified Paths:
--------------
MacRuby/trunk/lib/rubygems/builder.rb
MacRuby/trunk/lib/rubygems/command_manager.rb
MacRuby/trunk/lib/rubygems/commands/check_command.rb
MacRuby/trunk/lib/rubygems/commands/cleanup_command.rb
MacRuby/trunk/lib/rubygems/commands/dependency_command.rb
MacRuby/trunk/lib/rubygems/commands/environment_command.rb
MacRuby/trunk/lib/rubygems/commands/generate_index_command.rb
MacRuby/trunk/lib/rubygems/commands/help_command.rb
MacRuby/trunk/lib/rubygems/commands/mirror_command.rb
MacRuby/trunk/lib/rubygems/commands/query_command.rb
MacRuby/trunk/lib/rubygems/commands/sources_command.rb
MacRuby/trunk/lib/rubygems/commands/specification_command.rb
MacRuby/trunk/lib/rubygems/commands/update_command.rb
MacRuby/trunk/lib/rubygems/config_file.rb
MacRuby/trunk/lib/rubygems/dependency.rb
MacRuby/trunk/lib/rubygems/ext/builder.rb
MacRuby/trunk/lib/rubygems/indexer.rb
MacRuby/trunk/lib/rubygems/install_update_options.rb
MacRuby/trunk/lib/rubygems/old_format.rb
MacRuby/trunk/lib/rubygems/package/tar_input.rb
MacRuby/trunk/lib/rubygems/remote_fetcher.rb
MacRuby/trunk/lib/rubygems/server.rb
MacRuby/trunk/lib/rubygems/source_index.rb
MacRuby/trunk/lib/rubygems/source_info_cache.rb
MacRuby/trunk/lib/rubygems/spec_fetcher.rb
MacRuby/trunk/lib/rubygems/validator.rb
MacRuby/trunk/lib/rubygems.rb
Modified: MacRuby/trunk/lib/rubygems/builder.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/builder.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/builder.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -11,8 +11,7 @@
rescue LoadError
end
-Gem.load_yaml
-
+require 'yaml'
require 'rubygems/package'
require 'rubygems/security'
@@ -78,7 +77,11 @@
def write_package
open @spec.file_name, 'wb' do |gem_io|
Gem::Package.open gem_io, 'w', @signer do |pkg|
- yaml = @spec.to_yaml
+ yaml = if defined?(Psych) then
+ Psych.dump(@spec)
+ else
+ YAML.dump(@spec)
+ end
pkg.metadata = yaml
@spec.files.each do |file|
Modified: MacRuby/trunk/lib/rubygems/command_manager.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/command_manager.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/command_manager.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -56,6 +56,7 @@
register_command :install
register_command :list
register_command :lock
+ register_command :mirror
register_command :outdated
register_command :owner
register_command :pristine
Modified: MacRuby/trunk/lib/rubygems/commands/check_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/check_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/check_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -21,10 +21,25 @@
options[:alien] = true
end
- add_version_option 'check'
+ add_option('-v', '--verbose', "Spew more words") do |value, options|
+ options[:verbose] = true
+ end
+
+ add_option('-t', '--test', "Run unit tests for gem") do |value, options|
+ options[:test] = true
+ end
+
+ add_version_option 'run tests for'
end
def execute
+ if options[:test]
+ version = options[:version] || Gem::Requirement.default
+ dep = Gem::Dependency.new get_one_gem_name, version
+ gem_spec = Gem::SourceIndex.from_installed_gems.search(dep).first
+ Gem::Validator.new.unit_test(gem_spec)
+ end
+
if options[:alien]
say "Performing the 'alien' operation"
say
@@ -37,7 +52,7 @@
say " #{error_entry.problem}"
end
else
- say "#{key} is error-free" if Gem.configuration.verbose
+ say "#{key} is error-free" if options[:verbose]
end
say
end
Modified: MacRuby/trunk/lib/rubygems/commands/cleanup_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/cleanup_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/cleanup_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -8,7 +8,7 @@
def initialize
super 'cleanup',
'Clean up old versions of installed gems in the local repository',
- :force => false, :install_dir => Gem.dir
+ :force => false, :test => false, :install_dir => Gem.dir
add_option('-d', '--dryrun', "") do |value, options|
options[:dryrun] = true
Modified: MacRuby/trunk/lib/rubygems/commands/dependency_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/dependency_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/dependency_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -76,13 +76,25 @@
if remote? and not options[:reverse_dependencies] then
fetcher = Gem::SpecFetcher.fetcher
- specs_and_sources = fetcher.find_matching(dependency, false, true,
- dependency.prerelease?)
+ begin
+ specs_and_sources = fetcher.find_matching(dependency, false, true,
+ dependency.prerelease?)
- specs_and_sources.each do |spec_tuple, source_uri|
- spec = fetcher.fetch_spec spec_tuple, URI.parse(source_uri)
+ specs_and_sources.each do |spec_tuple, source_uri|
+ spec = fetcher.fetch_spec spec_tuple, URI.parse(source_uri)
- source_indexes[source_uri].add_spec spec
+ source_indexes[source_uri].add_spec spec
+ end
+ rescue Gem::RemoteFetcher::FetchError => e
+ raise unless fetcher.warn_legacy e do
+ require 'rubygems/source_info_cache'
+
+ specs = Gem::SourceInfoCache.search_with_source dependency, false
+
+ specs.each do |spec, source_uri|
+ source_indexes[source_uri].add_spec spec
+ end
+ end
end
end
Modified: MacRuby/trunk/lib/rubygems/commands/environment_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/environment_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/environment_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -13,7 +13,6 @@
gempath display path used to search for gems
version display the gem format version
remotesources display the remote gem servers
- platform display the supporte gem platforms
<omitted> display everything
EOF
return args.gsub(/^\s+/, '')
@@ -33,6 +32,8 @@
levels
:update_sources: Enable/disable automatic updating of repository metadata
:backtrace: Print backtrace when RubyGems encounters an error
+ :bulk_threshold: Switch to a bulk update when this many sources are out of
+ date (legacy setting)
:gempath: The paths in which to look for gems
gem_command: A string containing arguments for the specified gem command
@@ -75,8 +76,6 @@
out << Gem.path.join(File::PATH_SEPARATOR)
when /^remotesources/ then
out << Gem.sources.join("\n")
- when /^platform/ then
- out << Gem.platforms.join(File::PATH_SEPARATOR)
when nil then
out = "RubyGems Environment:\n"
Modified: MacRuby/trunk/lib/rubygems/commands/generate_index_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/generate_index_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/generate_index_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -19,7 +19,8 @@
end
add_option '--[no-]legacy',
- 'Generate Marshal.4.8' do |value, options|
+ 'Generate indexes for RubyGems older than',
+ '1.2.0' do |value, options|
unless options[:build_modern] or value then
raise OptionParser::InvalidOption, 'no indicies will be built'
end
@@ -86,12 +87,20 @@
quick/Marshal.<version>/<gemname>.gemspec.rz # Marshal quick index file
# these files support legacy RubyGems
+ quick/index
+ quick/index.rz # quick index manifest
+ quick/<gemname>.gemspec.rz # legacy YAML quick index
+ # file
Marshal.<version>
Marshal.<version>.Z # Marshal full index
+ yaml
+ yaml.Z # legacy YAML full index
The .Z and .rz extension files are compressed with the inflate algorithm.
The Marshal version number comes from ruby's Marshal::MAJOR_VERSION and
Marshal::MINOR_VERSION constants. It is used to ensure compatibility.
+The yaml indexes exist for legacy RubyGems clients and fallback in case of
+Marshal version changes.
If --rss-host and --rss-gem-host are given an RSS feed will be generated at
index.rss containing gems released in the last two days.
Modified: MacRuby/trunk/lib/rubygems/commands/help_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/help_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/help_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -14,6 +14,11 @@
gem install rake --remote
+* Install 'rake' from remote server, and run unit tests,
+ and generate RDocs:
+
+ gem install --remote rake --test --rdoc --ri
+
* Install 'rake', but only version 0.3.1, even if dependencies
are not met, and into a user-specific directory:
Modified: MacRuby/trunk/lib/rubygems/commands/mirror_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/mirror_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/mirror_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -1,12 +1,12 @@
-require 'yaml'
-require 'zlib'
-
require 'rubygems/command'
-require 'open-uri'
class Gem::Commands::MirrorCommand < Gem::Command
def initialize
+ require 'yaml'
+ require 'zlib'
+ require 'open-uri'
+
super 'mirror', 'Mirror a gem repository'
end
Modified: MacRuby/trunk/lib/rubygems/commands/query_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/query_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/query_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -108,12 +108,32 @@
all = options[:all]
- fetcher = Gem::SpecFetcher.fetcher
- spec_tuples = fetcher.find_matching dep, all, false, prerelease
+ begin
+ fetcher = Gem::SpecFetcher.fetcher
+ spec_tuples = fetcher.find_matching dep, all, false, prerelease
- spec_tuples += fetcher.find_matching dep, false, false, true if
- prerelease and all
+ spec_tuples += fetcher.find_matching dep, false, false, true if
+ prerelease and all
+ rescue Gem::RemoteFetcher::FetchError => e
+ if prerelease then
+ raise Gem::OperationNotSupportedError,
+ "Prereleases not supported on legacy repositories"
+ end
+ raise unless fetcher.warn_legacy e do
+ require 'rubygems/source_info_cache'
+
+ dep.name = '' if dep.name == //
+
+ specs = Gem::SourceInfoCache.search_with_source dep, false, all
+
+ spec_tuples = specs.map do |spec, source_uri|
+ [[spec.name, spec.version, spec.original_platform, spec],
+ source_uri]
+ end
+ end
+ end
+
output_query_results spec_tuples
end
end
Modified: MacRuby/trunk/lib/rubygems/commands/sources_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/sources_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/sources_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -80,7 +80,23 @@
rescue URI::Error, ArgumentError
say "#{source_uri} is not a URI"
rescue Gem::RemoteFetcher::FetchError => e
- say "Error fetching #{source_uri}:\n\t#{e.message}"
+ yaml_uri = uri + 'yaml'
+ gem_repo = Gem::RemoteFetcher.fetcher.fetch_size yaml_uri rescue false
+
+ if e.uri =~ /specs\.#{Regexp.escape Gem.marshal_version}\.gz$/ and
+ gem_repo then
+
+ alert_warning <<-EOF
+RubyGems 1.2+ index not found for:
+\t#{source_uri}
+
+Will cause RubyGems to revert to legacy indexes, degrading performance.
+ EOF
+
+ say "#{source_uri} added to sources"
+ else
+ say "Error fetching #{source_uri}:\n\t#{e.message}"
+ end
end
end
@@ -100,10 +116,15 @@
if options[:update] then
fetcher = Gem::SpecFetcher.fetcher
- 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'
+ if fetcher.legacy_repos.empty? then
+ 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
+ Gem::SourceInfoCache.cache.flush
end
say "source cache successfully updated"
Modified: MacRuby/trunk/lib/rubygems/commands/specification_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/specification_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/specification_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -10,7 +10,7 @@
include Gem::VersionOption
def initialize
- Gem.load_yaml
+ require 'yaml'
super 'specification', 'Display gem specification (in yaml)',
:domain => :local, :version => Gem::Requirement.default,
Modified: MacRuby/trunk/lib/rubygems/commands/update_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/update_command.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/commands/update_command.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -17,7 +17,8 @@
'Update the named gems (or all installed gems) in the local repository',
:generate_rdoc => true,
:generate_ri => true,
- :force => false
+ :force => false,
+ :test => false
add_install_update_options
@@ -36,7 +37,7 @@
end
def defaults_str # :nodoc:
- "--rdoc --ri --no-force --install-dir #{Gem.dir}"
+ "--rdoc --ri --no-force --no-test --install-dir #{Gem.dir}"
end
def usage # :nodoc:
@@ -62,19 +63,6 @@
hig['rubygems-update'] = rubygems_update
options[:user_install] = false
-
- Gem.source_index.refresh!
-
- update_gems = Gem.source_index.find_name 'rubygems-update'
-
- latest_update_gem = update_gems.sort_by { |s| s.version }.last
-
- say "Updating RubyGems to #{latest_update_gem.version}"
- installed = do_rubygems_update latest_update_gem.version
-
- say "RubyGems system software updated" if installed
-
- return
else
say "Updating installed gems"
@@ -112,22 +100,35 @@
end
end
- if updated.empty? then
- say "Nothing to update"
+ if gems_to_update.include? "rubygems-update" then
+ Gem.source_index.refresh!
+
+ update_gems = Gem.source_index.find_name 'rubygems-update'
+
+ latest_update_gem = update_gems.sort_by { |s| s.version }.last
+
+ say "Updating RubyGems to #{latest_update_gem.version}"
+ installed = do_rubygems_update latest_update_gem.version
+
+ say "RubyGems system software updated" if installed
else
- say "Gems updated: #{updated.map { |spec| spec.name }.join ', '}"
+ if updated.empty? then
+ say "Nothing to update"
+ else
+ say "Gems updated: #{updated.map { |spec| spec.name }.join ', '}"
- if options[:generate_ri] then
- updated.each do |gem|
- Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri
+ if options[:generate_ri] then
+ updated.each do |gem|
+ Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri
+ end
+
+ Gem::DocManager.update_ri_cache
end
- Gem::DocManager.update_ri_cache
- end
-
- if options[:generate_rdoc] then
- updated.each do |gem|
- Gem::DocManager.new(gem, options[:rdoc_args]).generate_rdoc
+ if options[:generate_rdoc] then
+ updated.each do |gem|
+ Gem::DocManager.new(gem, options[:rdoc_args]).generate_rdoc
+ end
end
end
end
@@ -166,9 +167,23 @@
dependency = Gem::Dependency.new l_spec.name, "> #{l_spec.version}"
- fetcher = Gem::SpecFetcher.fetcher
- spec_tuples = fetcher.find_matching dependency
+ begin
+ fetcher = Gem::SpecFetcher.fetcher
+ spec_tuples = fetcher.find_matching dependency
+ rescue Gem::RemoteFetcher::FetchError => e
+ raise unless fetcher.warn_legacy e do
+ require 'rubygems/source_info_cache'
+ dependency.name = '' if dependency.name == //
+
+ specs = Gem::SourceInfoCache.search_with_source dependency
+
+ spec_tuples = specs.map do |spec, source_uri|
+ [[spec.name, spec.version, spec.original_platform], source_uri]
+ end
+ end
+ end
+
matching_gems = spec_tuples.select do |(name, _, platform),|
name == l_name and Gem::Platform.match platform
end
Modified: MacRuby/trunk/lib/rubygems/config_file.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/config_file.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/config_file.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -205,7 +205,7 @@
dirname = File.dirname(credentials_path)
Dir.mkdir(dirname) unless File.exists?(dirname)
- Gem.load_yaml
+ require 'yaml'
File.open(credentials_path, 'w') do |f|
f.write config.to_yaml
@@ -215,10 +215,9 @@
end
def load_file(filename)
- Gem.load_yaml
-
return {} unless filename and File.exists?(filename)
begin
+ require 'yaml'
YAML.load(File.read(filename))
rescue ArgumentError
warn "Failed to load #{config_file_name}"
@@ -313,6 +312,7 @@
# Writes out this config file, replacing its source.
def write
+ require 'yaml'
open config_file_name, 'w' do |io|
io.write to_yaml
end
Modified: MacRuby/trunk/lib/rubygems/dependency.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/dependency.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/dependency.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -5,6 +5,18 @@
class Gem::Dependency
+ # :stopdoc:
+ @warned_version_requirement = false
+
+ def self.warned_version_requirement
+ @warned_version_requirement
+ end
+
+ def self.warned_version_requirement= value
+ @warned_version_requirement = value
+ end
+ # :startdoc:
+
##
# Valid dependency types.
#--
@@ -121,6 +133,12 @@
@requirement = @version_requirements if defined?(@version_requirements)
end
+ ##
+ # Rails subclasses Gem::Dependency and uses this method, so we'll hack
+ # around it.
+
+ alias __requirement requirement # :nodoc:
+
def requirements_list
requirement.as_list
end
@@ -129,6 +147,30 @@
"#{name} (#{requirement}, #{type})"
end
+ def version_requirements # :nodoc:
+ unless Gem::Dependency.warned_version_requirement then
+ warn "#{Gem.location_of_caller.join ':'}:Warning: " \
+ "Gem::Dependency#version_requirements is deprecated " \
+ "and will be removed on or after August 2010. " \
+ "Use #requirement"
+
+ Gem::Dependency.warned_version_requirement = true
+ end
+
+ __requirement
+ end
+
+ alias version_requirement version_requirements # :nodoc:
+
+ def version_requirements= requirements # :nodoc:
+ warn "#{Gem.location_of_caller.join ':'}:Warning: " \
+ "Gem::Dependency#version_requirements= is deprecated " \
+ "and will be removed on or after August 2010. " \
+ "Use Gem::Dependency.new."
+
+ @requirement = Gem::Requirement.create requirements
+ end
+
def == other # :nodoc:
Gem::Dependency === other &&
self.name == other.name &&
Modified: MacRuby/trunk/lib/rubygems/ext/builder.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/ext/builder.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/ext/builder.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -22,9 +22,7 @@
File.open('Makefile', 'wb') {|f| f.print mf}
- # try to find make program from Ruby configue arguments first
- RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
- make_program = $1 || ENV['make']
+ make_program = ENV['make']
unless make_program then
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
end
Modified: MacRuby/trunk/lib/rubygems/indexer.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/indexer.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/indexer.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -136,6 +136,42 @@
# Builds indicies for RubyGems older than 1.2.x
def build_legacy_indicies(index)
+ progress = ui.progress_reporter index.size,
+ "Generating YAML quick index gemspecs for #{index.size} gems",
+ "Complete"
+
+ Gem.time 'Generated YAML quick index gemspecs' do
+ index.released_gems.each do |original_name, spec|
+ spec_file_name = "#{original_name}.gemspec.rz"
+ yaml_name = File.join @quick_dir, spec_file_name
+
+ yaml_zipped = Gem.deflate spec.to_yaml
+ open yaml_name, 'wb' do |io| io.write yaml_zipped end
+
+ progress.updated original_name
+ end
+
+ progress.done
+ end
+
+ say "Generating quick index"
+
+ Gem.time 'Generated quick index' do
+ open @quick_index, 'wb' do |io|
+ io.puts index.sort.map { |_, spec| spec.original_name }
+ end
+ end
+
+ say "Generating latest index"
+
+ Gem.time 'Generated latest index' do
+ open @latest_index, 'wb' do |io|
+ io.puts index.latest_specs.sort.map { |spec| spec.original_name }
+ end
+ end
+
+ # Don't need prerelease legacy index
+
say "Generating Marshal master index"
Gem.time 'Generated Marshal master index' do
@@ -144,6 +180,32 @@
end
end
+ progress = ui.progress_reporter index.size,
+ "Generating YAML master index for #{index.size} gems (this may take a while)",
+ "Complete"
+
+ Gem.time 'Generated YAML master index' do
+ open @master_index, 'wb' do |io|
+ io.puts "--- !ruby/object:#{index.class}"
+ io.puts "gems:"
+
+ gems = index.sort_by { |name, gemspec| gemspec.sort_obj }
+ gems.each do |original_name, gemspec|
+ yaml = gemspec.to_yaml.gsub(/^/, ' ')
+ yaml = yaml.sub(/\A ---/, '') # there's a needed extra ' ' here
+ io.print " #{original_name}:"
+ io.puts yaml
+
+ progress.updated original_name
+ end
+ end
+
+ progress.done
+ end
+
+ @files << @quick_dir
+ @files << @master_index
+ @files << "#{@master_index}.Z"
@files << @marshal_index
@files << "#{@marshal_index}.Z"
end
@@ -400,8 +462,17 @@
Gem.time 'Compressed indicies' do
if @build_legacy then
+ compress @quick_index, 'rz'
+ paranoid @quick_index, 'rz'
+
+ compress @latest_index, 'rz'
+ paranoid @latest_index, 'rz'
+
compress @marshal_index, 'Z'
paranoid @marshal_index, 'Z'
+
+ compress @master_index, 'Z'
+ paranoid @master_index, 'Z'
end
if @build_modern then
Modified: MacRuby/trunk/lib/rubygems/install_update_options.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/install_update_options.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/install_update_options.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -58,6 +58,11 @@
options[:force] = value
end
+ add_option(:"Install/Update", '-t', '--[no-]test',
+ 'Run unit tests prior to installation') do |value, options|
+ options[:test] = value
+ end
+
add_option(:"Install/Update", '-w', '--[no-]wrappers',
'Use bin wrappers for executables',
'Not available on dosish platforms') do |value, options|
@@ -111,7 +116,7 @@
# Default options for the gem install command.
def install_update_defaults_str
- '--rdoc --no-force --wrappers'
+ '--rdoc --no-force --no-test --wrappers'
end
end
Modified: MacRuby/trunk/lib/rubygems/old_format.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/old_format.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/old_format.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -22,9 +22,8 @@
def initialize(gem_path)
require 'fileutils'
+ require 'yaml'
require 'zlib'
- Gem.load_yaml
-
@gem_path = gem_path
end
Modified: MacRuby/trunk/lib/rubygems/package/tar_input.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/package/tar_input.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/package/tar_input.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -4,8 +4,8 @@
# See LICENSE.txt for additional licensing information.
#--
-require 'zlib'
-Gem.load_yaml
+require "yaml"
+require "zlib"
class Gem::Package::TarInput
@@ -205,8 +205,8 @@
def zipped_stream(entry)
# XXX MACRUBY we also enter the first condition
if true#defined? Rubinius or defined? Maglev then
+ # these implementations have working Zlib
require 'stringio'
- # these implementations have working Zlib
zis = Zlib::GzipReader.new entry
dis = zis.read
is = StringIO.new(dis)
Modified: MacRuby/trunk/lib/rubygems/remote_fetcher.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/remote_fetcher.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/remote_fetcher.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -195,22 +195,14 @@
def escape(str)
return unless str
- @uri_parser ||= uri_escaper
- @uri_parser.escape str
+ URI.escape(str)
end
def unescape(str)
return unless str
- @uri_parser ||= uri_escaper
- @uri_parser.unescape str
+ URI.unescape(str)
end
- def uri_escaper
- URI::Parser.new
- rescue NameError
- URI
- end
-
##
# Returns an HTTP proxy URI if one is set in the environment variables.
Modified: MacRuby/trunk/lib/rubygems/server.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/server.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/server.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -1,4 +1,5 @@
require 'webrick'
+require 'yaml'
require 'zlib'
require 'erb'
@@ -20,6 +21,7 @@
# * legacy indexes:
# * "/Marshal.#{Gem.marshal_version}" - Full SourceIndex dump of metadata
# for installed gems
+# * "/yaml" - YAML dump of metadata for installed gems - deprecated
#
# == Usage
#
@@ -552,6 +554,19 @@
add_date res
case req.request_uri.path
+ when '/quick/index' then
+ res.body << @source_index.map { |name,| name }.sort.join("\n")
+ when '/quick/index.rz' then
+ index = @source_index.map { |name,| name }.sort.join("\n")
+ res['content-type'] = 'application/x-deflate'
+ res.body << Gem.deflate(index)
+ when '/quick/latest_index' then
+ index = @source_index.latest_specs.map { |spec| spec.full_name }
+ res.body << index.sort.join("\n")
+ when '/quick/latest_index.rz' then
+ index = @source_index.latest_specs.map { |spec| spec.full_name }
+ res['content-type'] = 'application/x-deflate'
+ res.body << Gem.deflate(index.sort.join("\n"))
when %r|^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)-([0-9.]+)(-.*?)?\.gemspec\.rz$| then
dep = Gem::Dependency.new $2, $3
specs = @source_index.search dep
@@ -576,6 +591,9 @@
elsif marshal_format then
res['content-type'] = 'application/x-deflate'
res.body << Gem.deflate(Marshal.dump(specs.first))
+ else # deprecated YAML format
+ res['content-type'] = 'application/x-deflate'
+ res.body << Gem.deflate(specs.first.to_yaml)
end
else
raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found."
@@ -655,12 +673,10 @@
template = ERB.new(DOC_TEMPLATE)
res['content-type'] = 'text/html'
+ # this is used by binding, 1.9.3dev warns anyways
values = { "gem_count" => specs.size.to_s, "specs" => specs,
"total_file_count" => total_file_count.to_s }
- # suppress 1.9.3dev warning about unused variable
- values = values
-
result = template.result binding
res.body = result
end
@@ -754,6 +770,9 @@
WEBrick::Daemon.start if @daemon
+ @server.mount_proc "/yaml", method(:yaml)
+ @server.mount_proc "/yaml.Z", method(:yaml)
+
@server.mount_proc "/Marshal.#{Gem.marshal_version}", method(:Marshal)
@server.mount_proc "/Marshal.#{Gem.marshal_version}.Z", method(:Marshal)
@@ -818,6 +837,28 @@
end
end
+ def yaml(req, res)
+ @source_index.refresh!
+
+ add_date res
+
+ index = @source_index.to_yaml
+
+ if req.path =~ /Z$/ then
+ res['content-type'] = 'application/x-deflate'
+ index = Gem.deflate index
+ else
+ res['content-type'] = 'text/plain'
+ end
+
+ if req.request_method == 'HEAD' then
+ res['content-length'] = index.length
+ return
+ end
+
+ res.body << index
+ end
+
def launch
listeners = @server.listeners.map{|l| l.addr[2] }
Modified: MacRuby/trunk/lib/rubygems/source_index.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/source_index.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/source_index.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -4,6 +4,7 @@
# See LICENSE.txt for permissions.
#++
+require 'rubygems/user_interaction'
require 'rubygems/specification'
##
@@ -21,6 +22,8 @@
include Enumerable
+ include Gem::UserInteraction
+
attr_reader :gems # :nodoc:
##
@@ -29,6 +32,8 @@
attr_accessor :spec_dirs
class << self
+ include Gem::UserInteraction
+
##
# Factory method to construct a source index instance for a given
# path.
@@ -317,10 +322,20 @@
latest_specs.each do |local|
dependency = Gem::Dependency.new local.name, ">= #{local.version}"
- fetcher = Gem::SpecFetcher.fetcher
- remotes = fetcher.find_matching dependency
- remotes = remotes.map { |(_, version, _), _| version }
+ begin
+ fetcher = Gem::SpecFetcher.fetcher
+ remotes = fetcher.find_matching dependency
+ remotes = remotes.map { |(_, version, _), _| version }
+ rescue Gem::RemoteFetcher::FetchError => e
+ raise unless fetcher.warn_legacy e do
+ require 'rubygems/source_info_cache'
+ specs = Gem::SourceInfoCache.search_with_source dependency, true
+
+ remotes = specs.map { |spec,| spec.version }
+ end
+ end
+
latest = remotes.sort.last
outdateds << local.name if latest and local.version < latest
@@ -329,6 +344,43 @@
outdateds
end
+ ##
+ # Updates this SourceIndex from +source_uri+. If +all+ is false, only the
+ # latest gems are fetched.
+
+ def update(source_uri, all)
+ source_uri = URI.parse source_uri unless URI::Generic === source_uri
+ source_uri.path += '/' unless source_uri.path =~ /\/$/
+
+ use_incremental = false
+
+ begin
+ gem_names = fetch_quick_index source_uri, all
+ remove_extra gem_names
+ missing_gems = find_missing gem_names
+
+ return false if missing_gems.size.zero?
+
+ say "Missing metadata for #{missing_gems.size} gems" if
+ missing_gems.size > 0 and Gem.configuration.really_verbose
+
+ use_incremental = missing_gems.size <= Gem.configuration.bulk_threshold
+ rescue Gem::OperationNotSupportedError => ex
+ alert_error "Falling back to bulk fetch: #{ex.message}" if
+ Gem.configuration.really_verbose
+ use_incremental = false
+ end
+
+ if use_incremental then
+ update_with_missing(source_uri, missing_gems)
+ else
+ new_index = fetch_bulk_index(source_uri)
+ @gems.replace(new_index.gems)
+ end
+
+ true
+ end
+
def ==(other) # :nodoc:
self.class === other and @gems == other.gems
end
@@ -337,6 +389,167 @@
Marshal.dump(self)
end
+ private
+
+ def fetcher
+ require 'rubygems/remote_fetcher'
+
+ Gem::RemoteFetcher.fetcher
+ end
+
+ def fetch_index_from(source_uri)
+ @fetch_error = nil
+
+ indexes = %W[
+ Marshal.#{Gem.marshal_version}.Z
+ Marshal.#{Gem.marshal_version}
+ yaml.Z
+ yaml
+ ]
+
+ indexes.each do |name|
+ spec_data = nil
+ index = source_uri + name
+ begin
+ spec_data = fetcher.fetch_path index
+ spec_data = unzip(spec_data) if name =~ /\.Z$/
+
+ if name =~ /Marshal/ then
+ return Marshal.load(spec_data)
+ else
+ return YAML.load(spec_data)
+ end
+ rescue => e
+ if Gem.configuration.really_verbose then
+ alert_error "Unable to fetch #{name}: #{e.message}"
+ end
+
+ @fetch_error = e
+ end
+ end
+
+ nil
+ end
+
+ def fetch_bulk_index(source_uri)
+ say "Bulk updating Gem source index for: #{source_uri}" if
+ Gem.configuration.verbose
+
+ index = fetch_index_from(source_uri)
+ if index.nil? then
+ raise Gem::RemoteSourceException,
+ "Error fetching remote gem cache: #{@fetch_error}"
+ end
+ @fetch_error = nil
+ index
+ end
+
+ ##
+ # Get the quick index needed for incremental updates.
+
+ def fetch_quick_index(source_uri, all)
+ index = all ? 'index' : 'latest_index'
+
+ zipped_index = fetcher.fetch_path source_uri + "quick/#{index}.rz"
+
+ unzip(zipped_index).split("\n")
+ rescue ::Exception => e
+ unless all then
+ say "Latest index not found, using quick index" if
+ Gem.configuration.really_verbose
+
+ fetch_quick_index source_uri, true
+ else
+ raise Gem::OperationNotSupportedError,
+ "No quick index found: #{e.message}"
+ end
+ end
+
+ ##
+ # Make a list of full names for all the missing gemspecs.
+
+ def find_missing(spec_names)
+ unless defined? @originals then
+ @originals = {}
+ each do |full_name, spec|
+ @originals[spec.original_name] = spec
+ end
+ end
+
+ spec_names.find_all { |full_name|
+ @originals[full_name].nil?
+ }
+ end
+
+ def remove_extra(spec_names)
+ dictionary = {}
+ spec_names.each { |k| dictionary[k] = true }
+ each do |name, spec|
+ remove_spec name unless dictionary.include? spec.original_name
+ end
+ end
+
+ ##
+ # Unzip the given string.
+
+ def unzip(string)
+ require 'zlib'
+ Gem.inflate string
+ end
+
+ ##
+ # Tries to fetch Marshal representation first, then YAML
+
+ def fetch_single_spec(source_uri, spec_name)
+ @fetch_error = nil
+
+ begin
+ marshal_uri = source_uri + "quick/Marshal.#{Gem.marshal_version}/#{spec_name}.gemspec.rz"
+ zipped = fetcher.fetch_path marshal_uri
+ return Marshal.load(unzip(zipped))
+ rescue => ex
+ @fetch_error = ex
+
+ if Gem.configuration.really_verbose then
+ say "unable to fetch marshal gemspec #{marshal_uri}: #{ex.class} - #{ex}"
+ end
+ end
+
+ begin
+ yaml_uri = source_uri + "quick/#{spec_name}.gemspec.rz"
+ zipped = fetcher.fetch_path yaml_uri
+ return YAML.load(unzip(zipped))
+ rescue => ex
+ @fetch_error = ex
+ if Gem.configuration.really_verbose then
+ say "unable to fetch YAML gemspec #{yaml_uri}: #{ex.class} - #{ex}"
+ end
+ end
+
+ nil
+ end
+
+ ##
+ # Update the cached source index with the missing names.
+
+ def update_with_missing(source_uri, missing_names)
+ progress = ui.progress_reporter(missing_names.size,
+ "Updating metadata for #{missing_names.size} gems from #{source_uri}")
+ missing_names.each do |spec_name|
+ gemspec = fetch_single_spec(source_uri, spec_name)
+ if gemspec.nil? then
+ ui.say "Failed to download spec #{spec_name} from #{source_uri}:\n" \
+ "\t#{@fetch_error.message}"
+ else
+ add_spec gemspec
+ progress.updated spec_name
+ end
+ @fetch_error = nil
+ end
+ progress.done
+ progress.count
+ end
+
end
# :stopdoc:
Modified: MacRuby/trunk/lib/rubygems/source_info_cache.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/source_info_cache.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/source_info_cache.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -1,5 +1,3 @@
-require 'fileutils'
-
require 'rubygems'
require 'rubygems/source_info_cache_entry'
require 'rubygems/user_interaction'
@@ -102,6 +100,7 @@
end
def initialize # :nodoc:
+ require 'fileutils'
@cache_data = nil
@cache_file = nil
@dirty = false
@@ -285,17 +284,19 @@
cache_data.map do |source_uri, sic_entry|
next unless Gem.sources.include? source_uri
# TODO - Remove this gunk after 2008/11
- unless pattern.kind_of?(Gem::Dependency)
- pattern = Gem::Dependency.new(pattern, Gem::Requirement.default)
+ unless pattern.kind_of? Gem::Dependency then
+ pattern = Gem::Dependency.new pattern, Gem::Requirement.default
end
sic_entry.source_index.search pattern, platform_only
end.flatten.compact
end
+ ##
# Searches all source indexes for +pattern+. If +only_platform+ is true,
# only gems matching Gem.platforms will be selected. Returns an Array of
# pairs containing the Gem::Specification found and the source_uri it was
# found at.
+
def search_with_source(pattern, only_platform = false, all = false)
read_all_cache_data if all
Modified: MacRuby/trunk/lib/rubygems/spec_fetcher.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/spec_fetcher.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/spec_fetcher.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -11,12 +11,6 @@
include Gem::UserInteraction
include Gem::Text
- FILES = {
- :all => 'specs',
- :latest => 'latest_specs',
- :prerelease => 'prerelease_specs',
- }
-
##
# The SpecFetcher cache dir.
@@ -57,12 +51,6 @@
@latest_specs = {}
@prerelease_specs = {}
- @caches = {
- :latest => @latest_specs,
- :prerelease => @prerelease_specs,
- :all => @specs
- }
-
@fetcher = Gem::RemoteFetcher.fetcher
end
@@ -87,6 +75,14 @@
end
return [ss, errors]
+
+ rescue Gem::RemoteFetcher::FetchError => e
+ raise unless warn_legacy e do
+ require 'rubygems/source_info_cache'
+
+ return [Gem::SourceInfoCache.search_with_source(dependency,
+ matching_platform, all), nil]
+ end
end
def fetch(*args)
@@ -165,6 +161,29 @@
end
##
+ # Returns Array of gem repositories that were generated with RubyGems less
+ # than 1.2.
+
+ def legacy_repos
+ Gem.sources.reject do |source_uri|
+ source_uri = URI.parse source_uri
+ spec_path = source_uri + "specs.#{Gem.marshal_version}.gz"
+
+ begin
+ @fetcher.fetch_size spec_path
+ rescue Gem::RemoteFetcher::FetchError
+ begin
+ @fetcher.fetch_size(source_uri + 'yaml') # re-raise if non-repo
+ rescue Gem::RemoteFetcher::FetchError
+ alert_error "#{source_uri} does not appear to be a repository"
+ raise
+ end
+ false
+ end
+ end
+ end
+
+ ##
# Suggests a gem based on the supplied +gem_name+. Returns a string
# of the gem name if an approximate match can be found or nil
# otherwise. NOTE: for performance reasons only gems which exactly
@@ -207,10 +226,16 @@
:latest
end
- list = {}
- file = FILES[type]
- cache = @caches[type]
+ list = {}
+ file = { :latest => 'latest_specs',
+ :prerelease => 'prerelease_specs',
+ :all => 'specs' }[type]
+
+ cache = { :latest => @latest_specs,
+ :prerelease => @prerelease_specs,
+ :all => @specs }[type]
+
Gem.sources.each do |source_uri|
source_uri = URI.parse source_uri
@@ -277,5 +302,28 @@
specs
end
+ ##
+ # Warn about legacy repositories if +exception+ indicates only legacy
+ # repositories are available, and yield to the block. Returns false if the
+ # exception indicates some other FetchError.
+
+ def warn_legacy(exception)
+ uri = exception.uri.to_s
+ if uri =~ /specs\.#{Regexp.escape Gem.marshal_version}\.gz$/ then
+ alert_warning <<-EOF
+RubyGems 1.2+ index not found for:
+\t#{legacy_repos.join "\n\t"}
+
+RubyGems will revert to legacy indexes degrading performance.
+ EOF
+
+ yield
+
+ return true
+ end
+
+ false
+ end
+
end
Modified: MacRuby/trunk/lib/rubygems/validator.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/validator.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems/validator.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -7,6 +7,12 @@
require 'rubygems/format'
require 'rubygems/installer'
+begin
+ gem 'test-unit'
+rescue Gem::LoadError
+ # Ignore - use the test-unit library that's part of the standard library
+end
+
##
# Validator performs various gem file and gem database validation
@@ -161,6 +167,73 @@
errors
end
+ if RUBY_VERSION < '1.9' then
+ class TestRunner
+ def initialize(suite, ui)
+ @suite = suite
+ @ui = ui
+ end
+
+ def self.run(suite, ui)
+ require 'test/unit/ui/testrunnermediator'
+ return new(suite, ui).start
+ end
+
+ def start
+ @mediator = Test::Unit::UI::TestRunnerMediator.new(@suite)
+ @mediator.add_listener(Test::Unit::TestResult::FAULT, &method(:add_fault))
+ return @mediator.run_suite
+ end
+
+ def add_fault(fault)
+ if Gem.configuration.verbose then
+ @ui.say fault.long_display
+ end
+ end
+ end
+
+ autoload :TestRunner, 'test/unit/ui/testrunnerutilities'
+ end
+
+ ##
+ # Runs unit tests for a given gem specification
+
+ def unit_test(gem_spec)
+ start_dir = Dir.pwd
+ Dir.chdir(gem_spec.full_gem_path)
+ $: << gem_spec.full_gem_path
+ # XXX: why do we need this gem_spec when we've already got 'spec'?
+ test_files = gem_spec.test_files
+
+ if test_files.empty? then
+ say "There are no unit tests to run for #{gem_spec.full_name}"
+ return nil
+ end
+
+ gem gem_spec.name, "= #{gem_spec.version.version}"
+
+ test_files.each do |f| require f end
+
+ if RUBY_VERSION < '1.9' then
+ suite = Test::Unit::TestSuite.new("#{gem_spec.name}-#{gem_spec.version}")
+
+ ObjectSpace.each_object(Class) do |klass|
+ suite << klass.suite if (klass < Test::Unit::TestCase)
+ end
+
+ result = TestRunner.run suite, ui
+
+ alert_error result.to_s unless result.passed?
+ else
+ result = MiniTest::Unit.new
+ result.run
+ end
+
+ result
+ ensure
+ Dir.chdir(start_dir)
+ end
+
def remove_leading_dot_dir(path)
path.sub(/^\.\//, "")
end
Modified: MacRuby/trunk/lib/rubygems.rb
===================================================================
--- MacRuby/trunk/lib/rubygems.rb 2011-01-14 13:52:41 UTC (rev 5166)
+++ MacRuby/trunk/lib/rubygems.rb 2011-01-15 03:57:58 UTC (rev 5167)
@@ -5,24 +5,8 @@
# See LICENSE.txt for permissions.
#++
-gem_preluded = defined? Gem
+gem_disabled = !defined? Gem
-if defined?(Gem::QuickLoader) then
- Gem::QuickLoader.load_full_rubygems_library
-
- class << Gem
- remove_method :try_activate if Gem.respond_to?(:try_activate, true)
-
- def try_activate(path)
- spec = Gem.searcher.find(path)
- return false unless spec
-
- Gem.activate(spec.name, "= #{spec.version}")
- return true
- end
- end
-end
-
require 'rubygems/defaults'
require 'rbconfig'
require 'thread' # HACK: remove me for 1.5 - this is here just for rails
@@ -274,6 +258,9 @@
activate dep_gem, :sources => [spec, *sources]
end
+ # bin directory must come before library directories
+ spec.require_paths.unshift spec.bindir if spec.bindir
+
require_paths = spec.require_paths.map do |path|
File.join spec.full_gem_path, path
end
@@ -440,7 +427,7 @@
def self.dir
@gem_home ||= nil
- set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
+ set_home(ENV['GEM_HOME'] || Gem.configuration.home || default_dir) unless @gem_home
@gem_home
end
@@ -656,16 +643,6 @@
end
##
- # Loads YAML, preferring Psych
-
- def self.load_yaml
- require 'psych'
- rescue ::LoadError
- ensure
- require 'yaml'
- end
-
- ##
# The file name and line number of the caller of the caller of this method.
def self.location_of_caller
@@ -690,7 +667,7 @@
@gem_path ||= nil
unless @gem_path then
- paths = [ENV['GEM_PATH'] || default_path]
+ paths = [ENV['GEM_PATH'] || Gem.configuration.path || default_path]
if defined?(APPLE_GEM_HOME) and not ENV['GEM_PATH'] then
paths << APPLE_GEM_HOME
@@ -1116,6 +1093,11 @@
MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/"
+ ##
+ # Location of legacy YAML quick gemspecs on remote repositories
+
+ YAML_SPEC_DIR = 'quick/'
+
autoload :Version, 'rubygems/version'
autoload :Requirement, 'rubygems/requirement'
autoload :Dependency, 'rubygems/dependency'
@@ -1126,7 +1108,6 @@
autoload :SourceIndex, 'rubygems/source_index'
autoload :Platform, 'rubygems/platform'
autoload :Builder, 'rubygems/builder'
- autoload :ConfigFile, 'rubygems/config_file'
end
module Kernel
@@ -1183,33 +1164,32 @@
require 'rubygems/exceptions'
-unless gem_preluded then
+begin
+ ##
+ # Defaults the operating system (or packager) wants to provide for RubyGems.
+
+ require 'rubygems/defaults/operating_system'
+rescue LoadError
+end
+
+if defined?(RUBY_ENGINE) then
begin
##
- # Defaults the operating system (or packager) wants to provide for RubyGems.
+ # Defaults the ruby implementation wants to provide for RubyGems
- require 'rubygems/defaults/operating_system'
+ require "rubygems/defaults/#{RUBY_ENGINE}"
rescue LoadError
end
-
- if defined?(RUBY_ENGINE) then
- begin
- ##
- # Defaults the ruby implementation wants to provide for RubyGems
-
- require "rubygems/defaults/#{RUBY_ENGINE}"
- rescue LoadError
- end
- end
end
+require 'rubygems/config_file'
+
##
# Enables the require hook for RubyGems.
#
# Ruby 1.9 allows --disable-gems, so we require it when we didn't detect a Gem
# constant at rubygems.rb load time.
-require 'rubygems/custom_require' unless gem_preluded and RUBY_VERSION > '1.9'
+require 'rubygems/custom_require' if gem_disabled or RUBY_VERSION < '1.9'
Gem.clear_paths
-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110114/a11972a3/attachment-0001.html>
More information about the macruby-changes
mailing list