[前][次][番号順一覧][スレッド一覧]

ruby-changes:25919

From: drbrain <ko1@a...>
Date: Thu, 29 Nov 2012 15:54:12 +0900 (JST)
Subject: [ruby-changes:25919] drbrain:r37976 (trunk): * lib/rubygems*: Updated to RubyGems 2.0

drbrain	2012-11-29 15:52:18 +0900 (Thu, 29 Nov 2012)

  New Revision: 37976

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37976

  Log:
    * lib/rubygems*:  Updated to RubyGems 2.0
    * test/rubygems*:  ditto.
    
    * common.mk (prelude):  Updated for RubyGems 2.0 source rearrangement.
    
    * tool/change_maker.rb:  Allow invalid UTF-8 characters in source
      files.

  Added directories:
    trunk/lib/rubygems/core_ext/
    trunk/lib/rubygems/security/
  Added files:
    trunk/lib/rubygems/available_set.rb
    trunk/lib/rubygems/commands/mirror_command.rb
    trunk/lib/rubygems/commands/yank_command.rb
    trunk/lib/rubygems/compatibility.rb
    trunk/lib/rubygems/core_ext/kernel_gem.rb
    trunk/lib/rubygems/core_ext/kernel_require.rb
    trunk/lib/rubygems/dependency_resolver.rb
    trunk/lib/rubygems/install_message.rb
    trunk/lib/rubygems/name_tuple.rb
    trunk/lib/rubygems/package/digest_io.rb
    trunk/lib/rubygems/package/old.rb
    trunk/lib/rubygems/rdoc.rb
    trunk/lib/rubygems/request_set.rb
    trunk/lib/rubygems/security/policies.rb
    trunk/lib/rubygems/security/policy.rb
    trunk/lib/rubygems/security/signer.rb
    trunk/lib/rubygems/security/trust_dir.rb
    trunk/lib/rubygems/source.rb
    trunk/lib/rubygems/source_list.rb
    trunk/lib/rubygems/source_local.rb
    trunk/lib/rubygems/source_specific_file.rb
    trunk/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem
    trunk/lib/rubygems/ssl_certs/Entrust_net-Secure-Server-Certification-Authority.pem
    trunk/lib/rubygems/ssl_certs/VerisignClass3PublicPrimaryCertificationAuthority-G2.pem
    trunk/test/rubygems/alternate_cert.pem
    trunk/test/rubygems/alternate_cert_32.pem
    trunk/test/rubygems/alternate_key.pem
    trunk/test/rubygems/bad_rake.rb
    trunk/test/rubygems/child_cert.pem
    trunk/test/rubygems/child_cert_32.pem
    trunk/test/rubygems/child_key.pem
    trunk/test/rubygems/expired_cert.pem
    trunk/test/rubygems/future_cert.pem
    trunk/test/rubygems/future_cert_32.pem
    trunk/test/rubygems/good_rake.rb
    trunk/test/rubygems/grandchild_cert.pem
    trunk/test/rubygems/grandchild_cert_32.pem
    trunk/test/rubygems/grandchild_key.pem
    trunk/test/rubygems/invalid_issuer_cert.pem
    trunk/test/rubygems/invalid_issuer_cert_32.pem
    trunk/test/rubygems/invalid_key.pem
    trunk/test/rubygems/invalid_signer_cert.pem
    trunk/test/rubygems/invalid_signer_cert_32.pem
    trunk/test/rubygems/invalidchild_cert.pem
    trunk/test/rubygems/invalidchild_cert_32.pem
    trunk/test/rubygems/invalidchild_key.pem
    trunk/test/rubygems/public_cert_32.pem
    trunk/test/rubygems/public_key.pem
    trunk/test/rubygems/test_deprecate.rb
    trunk/test/rubygems/test_gem_available_set.rb
    trunk/test/rubygems/test_gem_commands_mirror.rb
    trunk/test/rubygems/test_gem_commands_search_command.rb
    trunk/test/rubygems/test_gem_commands_yank_command.rb
    trunk/test/rubygems/test_gem_dependency_resolver.rb
    trunk/test/rubygems/test_gem_name_tuple.rb
    trunk/test/rubygems/test_gem_package.rb
    trunk/test/rubygems/test_gem_package_old.rb
    trunk/test/rubygems/test_gem_rdoc.rb
    trunk/test/rubygems/test_gem_request_set.rb
    trunk/test/rubygems/test_gem_security_policy.rb
    trunk/test/rubygems/test_gem_security_signer.rb
    trunk/test/rubygems/test_gem_security_trust_dir.rb
    trunk/test/rubygems/test_gem_source.rb
    trunk/test/rubygems/test_gem_source_list.rb
    trunk/test/rubygems/test_gem_source_local.rb
    trunk/test/rubygems/test_gem_source_specific_file.rb
    trunk/test/rubygems/test_require.rb
    trunk/test/rubygems/wrong_key_cert.pem
    trunk/test/rubygems/wrong_key_cert_32.pem
  Removed directories:
    trunk/test/rubygems/gems/
  Removed files:
    trunk/lib/rubygems/builder.rb
    trunk/lib/rubygems/custom_require.rb
    trunk/lib/rubygems/doc_manager.rb
    trunk/lib/rubygems/format.rb
    trunk/lib/rubygems/gem_openssl.rb
    trunk/lib/rubygems/gem_path_searcher.rb
    trunk/lib/rubygems/old_format.rb
    trunk/lib/rubygems/package/f_sync_dir.rb
    trunk/lib/rubygems/package/tar_input.rb
    trunk/lib/rubygems/package/tar_output.rb
    trunk/lib/rubygems/require_paths_builder.rb
    trunk/lib/rubygems/source_index.rb
    trunk/test/rubygems/test_gem_builder.rb
    trunk/test/rubygems/test_gem_doc_manager.rb
    trunk/test/rubygems/test_gem_format.rb
    trunk/test/rubygems/test_gem_gem_path_searcher.rb
    trunk/test/rubygems/test_gem_package_tar_input.rb
    trunk/test/rubygems/test_gem_package_tar_output.rb
    trunk/test/rubygems/test_gem_source_index.rb
  Modified files:
    trunk/ChangeLog
    trunk/common.mk
    trunk/lib/rubygems/command.rb
    trunk/lib/rubygems/command_manager.rb
    trunk/lib/rubygems/commands/build_command.rb
    trunk/lib/rubygems/commands/cert_command.rb
    trunk/lib/rubygems/commands/check_command.rb
    trunk/lib/rubygems/commands/cleanup_command.rb
    trunk/lib/rubygems/commands/contents_command.rb
    trunk/lib/rubygems/commands/dependency_command.rb
    trunk/lib/rubygems/commands/environment_command.rb
    trunk/lib/rubygems/commands/fetch_command.rb
    trunk/lib/rubygems/commands/generate_index_command.rb
    trunk/lib/rubygems/commands/help_command.rb
    trunk/lib/rubygems/commands/install_command.rb
    trunk/lib/rubygems/commands/list_command.rb
    trunk/lib/rubygems/commands/lock_command.rb
    trunk/lib/rubygems/commands/outdated_command.rb
    trunk/lib/rubygems/commands/owner_command.rb
    trunk/lib/rubygems/commands/pristine_command.rb
    trunk/lib/rubygems/commands/push_command.rb
    trunk/lib/rubygems/commands/query_command.rb
    trunk/lib/rubygems/commands/rdoc_command.rb
    trunk/lib/rubygems/commands/search_command.rb
    trunk/lib/rubygems/commands/server_command.rb
    trunk/lib/rubygems/commands/setup_command.rb
    trunk/lib/rubygems/commands/sources_command.rb
    trunk/lib/rubygems/commands/specification_command.rb
    trunk/lib/rubygems/commands/uninstall_command.rb
    trunk/lib/rubygems/commands/unpack_command.rb
    trunk/lib/rubygems/commands/update_command.rb
    trunk/lib/rubygems/config_file.rb
    trunk/lib/rubygems/defaults.rb
    trunk/lib/rubygems/dependency.rb
    trunk/lib/rubygems/dependency_installer.rb
    trunk/lib/rubygems/dependency_list.rb
    trunk/lib/rubygems/deprecate.rb
    trunk/lib/rubygems/errors.rb
    trunk/lib/rubygems/exceptions.rb
    trunk/lib/rubygems/ext/builder.rb
    trunk/lib/rubygems/ext/configure_builder.rb
    trunk/lib/rubygems/ext/ext_conf_builder.rb
    trunk/lib/rubygems/ext/rake_builder.rb
    trunk/lib/rubygems/gem_runner.rb
    trunk/lib/rubygems/gemcutter_utilities.rb
    trunk/lib/rubygems/indexer.rb
    trunk/lib/rubygems/install_update_options.rb
    trunk/lib/rubygems/installer.rb
    trunk/lib/rubygems/installer_test_case.rb
    trunk/lib/rubygems/mock_gem_ui.rb
    trunk/lib/rubygems/package/tar_header.rb
    trunk/lib/rubygems/package/tar_reader.rb
    trunk/lib/rubygems/package/tar_writer.rb
    trunk/lib/rubygems/package.rb
    trunk/lib/rubygems/package_task.rb
    trunk/lib/rubygems/path_support.rb
    trunk/lib/rubygems/platform.rb
    trunk/lib/rubygems/remote_fetcher.rb
    trunk/lib/rubygems/requirement.rb
    trunk/lib/rubygems/security.rb
    trunk/lib/rubygems/server.rb
    trunk/lib/rubygems/spec_fetcher.rb
    trunk/lib/rubygems/specification.rb
    trunk/lib/rubygems/syck_hack.rb
    trunk/lib/rubygems/test_case.rb
    trunk/lib/rubygems/test_utilities.rb
    trunk/lib/rubygems/uninstaller.rb
    trunk/lib/rubygems/user_interaction.rb
    trunk/lib/rubygems/validator.rb
    trunk/lib/rubygems/version.rb
    trunk/lib/rubygems.rb
    trunk/test/rubygems/data/null-type.gemspec.rz
    trunk/test/rubygems/plugin/exception/rubygems_plugin.rb
    trunk/test/rubygems/plugin/standarderror/rubygems_plugin.rb
    trunk/test/rubygems/private_key.pem
    trunk/test/rubygems/public_cert.pem
    trunk/test/rubygems/rubygems/commands/crash_command.rb
    trunk/test/rubygems/test_config.rb
    trunk/test/rubygems/test_gem.rb
    trunk/test/rubygems/test_gem_command.rb
    trunk/test/rubygems/test_gem_command_manager.rb
    trunk/test/rubygems/test_gem_commands_build_command.rb
    trunk/test/rubygems/test_gem_commands_cert_command.rb
    trunk/test/rubygems/test_gem_commands_cleanup_command.rb
    trunk/test/rubygems/test_gem_commands_contents_command.rb
    trunk/test/rubygems/test_gem_commands_dependency_command.rb
    trunk/test/rubygems/test_gem_commands_fetch_command.rb
    trunk/test/rubygems/test_gem_commands_generate_index_command.rb
    trunk/test/rubygems/test_gem_commands_help_command.rb
    trunk/test/rubygems/test_gem_commands_install_command.rb
    trunk/test/rubygems/test_gem_commands_owner_command.rb
    trunk/test/rubygems/test_gem_commands_pristine_command.rb
    trunk/test/rubygems/test_gem_commands_push_command.rb
    trunk/test/rubygems/test_gem_commands_query_command.rb
    trunk/test/rubygems/test_gem_commands_sources_command.rb
    trunk/test/rubygems/test_gem_commands_specification_command.rb
    trunk/test/rubygems/test_gem_commands_uninstall_command.rb
    trunk/test/rubygems/test_gem_commands_unpack_command.rb
    trunk/test/rubygems/test_gem_commands_update_command.rb
    trunk/test/rubygems/test_gem_commands_which_command.rb
    trunk/test/rubygems/test_gem_config_file.rb
    trunk/test/rubygems/test_gem_dependency.rb
    trunk/test/rubygems/test_gem_dependency_installer.rb
    trunk/test/rubygems/test_gem_dependency_list.rb
    trunk/test/rubygems/test_gem_ext_ext_conf_builder.rb
    trunk/test/rubygems/test_gem_ext_rake_builder.rb
    trunk/test/rubygems/test_gem_gem_runner.rb
    trunk/test/rubygems/test_gem_gemcutter_utilities.rb
    trunk/test/rubygems/test_gem_indexer.rb
    trunk/test/rubygems/test_gem_install_update_options.rb
    trunk/test/rubygems/test_gem_installer.rb
    trunk/test/rubygems/test_gem_local_remote_options.rb
    trunk/test/rubygems/test_gem_package_tar_reader.rb
    trunk/test/rubygems/test_gem_package_tar_writer.rb
    trunk/test/rubygems/test_gem_path_support.rb
    trunk/test/rubygems/test_gem_platform.rb
    trunk/test/rubygems/test_gem_remote_fetcher.rb
    trunk/test/rubygems/test_gem_requirement.rb
    trunk/test/rubygems/test_gem_security.rb
    trunk/test/rubygems/test_gem_server.rb
    trunk/test/rubygems/test_gem_spec_fetcher.rb
    trunk/test/rubygems/test_gem_specification.rb
    trunk/test/rubygems/test_gem_uninstaller.rb
    trunk/test/rubygems/test_gem_validator.rb
    trunk/test/rubygems/test_gem_version.rb
    trunk/tool/change_maker.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37975)
+++ ChangeLog	(revision 37976)
@@ -1,3 +1,13 @@
+Thu Nov 29 15:51:54 2012  Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems*:  Updated to RubyGems 2.0
+	* test/rubygems*:  ditto.
+
+	* common.mk (prelude):  Updated for RubyGems 2.0 source rearrangement.
+
+	* tool/change_maker.rb:  Allow invalid UTF-8 characters in source
+	  files.
+
 Thu Nov 29 15:38:14 2012  Koichi Sasada  <ko1@a...>
 
 	* include/ruby/debug.h: provide rb_tracearg_*() APIs,
Index: lib/rubygems/old_format.rb
===================================================================
--- lib/rubygems/old_format.rb	(revision 37975)
+++ lib/rubygems/old_format.rb	(revision 37976)
@@ -1,153 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-require 'rubygems'
-
-##
-# The format class knows the guts of the RubyGem .gem file format and provides
-# the capability to read gem files
-
-class Gem::OldFormat
-
-  attr_accessor :spec, :file_entries, :gem_path
-
-  ##
-  # Constructs an instance of a Format object, representing the gem's data
-  # structure.
-  #
-  # gem:: [String] The file name of the gem
-
-  def initialize(gem_path)
-    require 'fileutils'
-    require 'zlib'
-    Gem.load_yaml
-
-    @gem_path = gem_path
-  end
-
-  ##
-  # Reads the named gem file and returns a Format object, representing the
-  # data from the gem file
-  #
-  # file_path:: [String] Path to the gem file
-
-  def self.from_file_by_path(file_path)
-    unless File.exist?(file_path)
-      raise Gem::Exception, "Cannot load gem file [#{file_path}]"
-    end
-
-    File.open(file_path, 'rb') do |file|
-      from_io(file, file_path)
-    end
-  end
-
-  ##
-  # Reads a gem from an io stream and returns a Format object, representing
-  # the data from the gem file
-  #
-  # io:: [IO] Stream from which to read the gem
-
-  def self.from_io(io, gem_path="(io)")
-    format = self.new(gem_path)
-    skip_ruby(io)
-    format.spec = read_spec(io)
-    format.file_entries = []
-    read_files_from_gem(io) do |entry, file_data|
-      format.file_entries << [entry, file_data]
-    end
-    format
-  end
-
-  private
-
-  ##
-  # Skips the Ruby self-install header.  After calling this method, the
-  # IO index will be set after the Ruby code.
-  #
-  # file:: [IO] The IO to process (skip the Ruby code)
-
-  def self.skip_ruby(file)
-    end_seen = false
-    loop {
-      line = file.gets
-      if(line == nil || line.chomp == "__END__") then
-        end_seen = true
-        break
-      end
-    }
-
-    if end_seen == false then
-      raise Gem::Exception.new("Failed to find end of ruby script while reading gem")
-    end
-  end
-
-  ##
-  # Reads the specification YAML from the supplied IO and constructs
-  # a Gem::Specification from it.  After calling this method, the
-  # IO index will be set after the specification header.
-  #
-  # file:: [IO] The IO to process
-
-  def self.read_spec(file)
-    yaml = ''
-
-    read_until_dashes file do |line|
-      yaml << line
-    end
-
-    Gem::Specification.from_yaml yaml
-  rescue YAML::Error => e
-    raise Gem::Exception, "Failed to parse gem specification out of gem file"
-  rescue ArgumentError => e
-    raise Gem::Exception, "Failed to parse gem specification out of gem file"
-  end
-
-  ##
-  # Reads lines from the supplied IO until a end-of-yaml (---) is
-  # reached
-  #
-  # file:: [IO] The IO to process
-  # block:: [String] The read line
-
-  def self.read_until_dashes(file)
-    while((line = file.gets) && line.chomp.strip != "---") do
-      yield line
-    end
-  end
-
-  ##
-  # Reads the embedded file data from a gem file, yielding an entry
-  # containing metadata about the file and the file contents themselves
-  # for each file that's archived in the gem.
-  # NOTE: Many of these methods should be extracted into some kind of
-  # Gem file read/writer
-  #
-  # gem_file:: [IO] The IO to process
-
-  def self.read_files_from_gem(gem_file)
-    errstr = "Error reading files from gem"
-    header_yaml = ''
-    begin
-      self.read_until_dashes(gem_file) do |line|
-        header_yaml << line
-      end
-      header = YAML.load(header_yaml)
-      raise Gem::Exception, errstr unless header
-
-      header.each do |entry|
-        file_data = ''
-        self.read_until_dashes(gem_file) do |line|
-          file_data << line
-        end
-        yield [entry, Zlib::Inflate.inflate(file_data.strip.unpack("m")[0])]
-      end
-    rescue Zlib::DataError
-      raise Gem::Exception, errstr
-    end
-  end
-
-end
-
Index: lib/rubygems/builder.rb
===================================================================
--- lib/rubygems/builder.rb	(revision 37975)
+++ lib/rubygems/builder.rb	(revision 37976)
@@ -1,99 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-require 'rubygems'
-require 'rubygems/user_interaction'
-
-Gem.load_yaml
-
-require 'rubygems/package'
-
-##
-# The Builder class processes RubyGem specification files
-# to produce a .gem file.
-
-class Gem::Builder
-
-  include Gem::UserInteraction
-
-  ##
-  # Constructs a builder instance for the provided specification
-  #
-  # spec:: [Gem::Specification] The specification instance
-
-  def initialize(spec)
-    @spec = spec
-  end
-
-  ##
-  # Builds the gem from the specification.  Returns the name of the file
-  # written.
-
-  def build(skip_validation=false)
-    @spec.mark_version
-    @spec.validate unless skip_validation
-    @signer = sign
-    write_package
-    say success if Gem.configuration.verbose
-    File.basename @spec.cache_file
-  end
-
-  def success
-    <<-EOM
-  Successfully built RubyGem
-  Name: #{@spec.name}
-  Version: #{@spec.version}
-  File: #{File.basename @spec.cache_file}
-EOM
-  end
-
-  private
-
-  ##
-  # If the signing key was specified, then load the file, and swap to the
-  # public key (TODO: we should probably just omit the signing key in favor of
-  # the signing certificate, but that's for the future, also the signature
-  # algorithm should be configurable)
-
-  def sign
-    signer = nil
-
-    if @spec.respond_to?(:signing_key) and @spec.signing_key then
-      require 'rubygems/security'
-
-      signer = Gem::Security::Signer.new @spec.signing_key, @spec.cert_chain
-      @spec.signing_key = nil
-      @spec.cert_chain = signer.cert_chain.map { |cert| cert.to_s }
-    end
-
-    signer
-  end
-
-  def write_package
-    file_name = File.basename @spec.cache_file
-    open file_name, 'wb' do |gem_io|
-      Gem::Package.open gem_io, 'w', @signer do |pkg|
-        yaml = @spec.to_yaml
-        pkg.metadata = yaml
-
-        @spec.files.each do |file|
-          next if File.directory?(file)
-          next if file == file_name # Don't add gem onto itself
-
-          stat = File.stat(file)
-          mode = stat.mode & 0777
-          size = stat.size
-
-          pkg.add_file_simple file, mode, size do |tar_io|
-            tar_io.write open(file, "rb") { |f| f.read }
-          end
-        end
-      end
-    end
-  end
-
-end
-
Index: lib/rubygems/format.rb
===================================================================
--- lib/rubygems/format.rb	(revision 37975)
+++ lib/rubygems/format.rb	(revision 37976)
@@ -1,82 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-require 'rubygems/package'
-
-##
-# Gem::Format knows the guts of the RubyGem .gem file format and provides the
-# capability to read gem files
-
-class Gem::Format
-
-  attr_accessor :spec
-  attr_accessor :file_entries
-  attr_accessor :gem_path
-
-  ##
-  # Constructs a Format representing the gem's data which came from +gem_path+
-
-  def initialize(gem_path)
-    @gem_path = gem_path
-  end
-
-  ##
-  # Reads the gem +file_path+ using +security_policy+ and returns a Format
-  # representing the data in the gem
-
-  def self.from_file_by_path(file_path, security_policy = nil)
-    unless File.file?(file_path)
-      raise Gem::Exception, "Cannot load gem at [#{file_path}] in #{Dir.pwd}"
-    end
-
-    start = File.read file_path, 20
-
-    if start.nil? or start.length < 20 then
-      nil
-    elsif start.include?("MD5SUM =") # old version gems
-      require 'rubygems/old_format'
-
-      Gem::OldFormat.from_file_by_path file_path
-    else
-      begin
-        open file_path, Gem.binary_mode do |io|
-          from_io io, file_path, security_policy
-        end
-      rescue Gem::Package::TarInvalidError => e
-        message = "corrupt gem (#{e.class}: #{e.message})"
-        raise Gem::Package::FormatError.new(message, file_path)
-      end
-    end
-  end
-
-  ##
-  # Reads a gem from +io+ at +gem_path+ using +security_policy+ and returns a
-  # Format representing the data from the gem
-
-  def self.from_io(io, gem_path="(io)", security_policy = nil)
-    format = new gem_path
-
-    Gem::Package.open io, 'r', security_policy do |pkg|
-      format.spec = pkg.metadata
-      format.file_entries = []
-
-      pkg.each do |entry|
-        size = entry.header.size
-        mode = entry.header.mode
-
-        format.file_entries << [{
-            "size" => size, "mode" => mode, "path" => entry.full_name,
-          },
-          entry.read
-        ]
-      end
-    end
-
-    format
-  end
-
-end
-
Index: lib/rubygems/doc_manager.rb
===================================================================
--- lib/rubygems/doc_manager.rb	(revision 37975)
+++ lib/rubygems/doc_manager.rb	(revision 37976)
@@ -1,243 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-require 'rubygems'
-
-##
-# The documentation manager generates RDoc and RI for RubyGems.
-
-class Gem::DocManager
-
-  include Gem::UserInteraction
-
-  @configured_args = []
-
-  def self.configured_args
-    @configured_args ||= []
-  end
-
-  def self.configured_args=(args)
-    case args
-    when Array
-      @configured_args = args
-    when String
-      @configured_args = args.split
-    end
-  end
-
-  ##
-  # Load RDoc from a gem if it is available, otherwise from Ruby's stdlib
-
-  def self.load_rdoc
-    begin
-      gem 'rdoc'
-    rescue Gem::LoadError
-      # use built-in RDoc
-    end
-
-    begin
-      require 'rdoc/rdoc'
-
-      @rdoc_version = if defined? RDoc::VERSION then
-                        Gem::Version.new RDoc::VERSION
-                      else
-                        Gem::Version.new '1.0.1' # HACK parsing is hard
-                      end
-
-    rescue LoadError => e
-      raise Gem::DocumentError,
-          "ERROR: RDoc documentation generator not installed: #{e}"
-    end
-  end
-
-  def self.rdoc_version
-    @rdoc_version
-  end
-
-  ##
-  # Updates the RI cache for RDoc 2 if it is installed
-
-  def self.update_ri_cache
-    load_rdoc rescue return
-
-    return unless defined? RDoc::VERSION # RDoc 1 does not have VERSION
-
-    require 'rdoc/ri/driver'
-
-    options = {
-      :use_cache => true,
-      :use_system => true,
-      :use_site => true,
-      :use_home => true,
-      :use_gems => true,
-      :formatter => RDoc::RI::Formatter,
-    }
-
-    RDoc::RI::Driver.new(options).class_cache
-  end
-
-  ##
-  # Create a document manager for +spec+. +rdoc_args+ contains arguments for
-  # RDoc (template etc.) as a String.
-
-  def initialize(spec, rdoc_args="")
-    require 'fileutils'
-    @spec = spec
-    @doc_dir = spec.doc_dir
-    @rdoc_args = rdoc_args.nil? ? [] : rdoc_args.split
-  end
-
-  ##
-  # Is the RDoc documentation installed?
-
-  def rdoc_installed?
-    File.exist?(File.join(@doc_dir, "rdoc"))
-  end
-
-  ##
-  # Is the RI documentation installed?
-
-  def ri_installed?
-    File.exist?(File.join(@doc_dir, "ri"))
-  end
-
-  ##
-  # Generate the RI documents for this gem spec.
-  #
-  # Note that if both RI and RDoc documents are generated from the same
-  # process, the RI docs should be done first (a likely bug in RDoc will cause
-  # RI docs generation to fail if run after RDoc).
-
-  def generate_ri
-    setup_rdoc
-    install_ri # RDoc bug, ri goes first
-
-    FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
-  end
-
-  ##
-  # Generate the RDoc documents for this gem spec.
-  #
-  # Note that if both RI and RDoc documents are generated from the same
-  # process, the RI docs should be done first (a likely bug in RDoc will cause
-  # RI docs generation to fail if run after RDoc).
-
-  def generate_rdoc
-    setup_rdoc
-    install_rdoc
-
-    FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
-  end
-
-  ##
-  # Generate and install RDoc into the documentation directory
-
-  def install_rdoc
-    rdoc_dir = File.join @doc_dir, 'rdoc'
-
-    FileUtils.rm_rf rdoc_dir
-
-    say "Installing RDoc documentation for #{@spec.full_name}..."
-    run_rdoc '--op', rdoc_dir
-  end
-
-  ##
-  # Generate and install RI into the documentation directory
-
-  def install_ri
-    ri_dir = File.join @doc_dir, 'ri'
-
-    FileUtils.rm_rf ri_dir
-
-    say "Installing ri documentation for #{@spec.full_name}..."
-    run_rdoc '--ri', '--op', ri_dir
-  end
-
-  ##
-  # Run RDoc with +args+, which is an ARGV style argument list
-
-  def run_rdoc(*args)
-    args << @spec.rdoc_options
-    args << self.class.configured_args
-    args << @spec.require_paths.clone
-    args << @spec.extra_rdoc_files
-    args << '--title' << "#{@spec.full_name} Documentation"
-    args << '--quiet'
-    args = args.flatten.map do |arg| arg.to_s end
-
-    if self.class.rdoc_version >= Gem::Version.new('2.4.0') then
-      args.delete '--inline-source'
-      args.delete '--promiscuous'
-      args.delete '-p'
-      args.delete '--one-file'
-      # HACK more
-    end
-
-    debug_args = args.dup
-
-    r = RDoc::RDoc.new
-
-    old_pwd = Dir.pwd
-    Dir.chdir @spec.full_gem_path
-
-    say "rdoc #{args.join ' '}" if Gem.configuration.really_verbose
-
-    begin
-      r.document args
-    rescue Errno::EACCES => e
-      dirname = File.dirname e.message.split("-")[1].strip
-      raise Gem::FilePermissionError.new(dirname)
-    rescue Interrupt => e
-      raise e
-    rescue Exception => ex
-      alert_error "While generating documentation for #{@spec.full_name}"
-      ui.errs.puts "... MESSAGE:   #{ex}"
-      ui.errs.puts "... RDOC args: #{debug_args.join(' ')}"
-      ui.errs.puts "\t#{ex.backtrace.join "\n\t"}" if
-        Gem.configuration.backtrace
-      terminate_interaction 1
-    ensure
-      Dir.chdir old_pwd
-    end
-  end
-
-  def setup_rdoc
-    if File.exist?(@doc_dir) && !File.writable?(@doc_dir) then
-      raise Gem::FilePermissionError.new(@doc_dir)
-    end
-
-    FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
-
-    self.class.load_rdoc
-  end
-
-  ##
-  # Remove RDoc and RI documentation
-
-  def uninstall_doc
-    base_dir = @spec.base_dir
-    raise Gem::FilePermissionError.new base_dir unless File.writable? base_dir
-
-    # TODO: ok... that's twice... ugh
-    old_name = [
-      @spec.name, @spec.version, @spec.original_platform].join '-'
-
-    doc_dir = @spec.doc_dir
-    unless File.directory? doc_dir then
-      doc_dir = File.join File.dirname(doc_dir), old_name
-    end
-
-    ri_dir = @spec.ri_dir
-    unless File.directory? ri_dir then
-      ri_dir = File.join File.dirname(ri_dir), old_name
-    end
-
-    FileUtils.rm_rf doc_dir
-    FileUtils.rm_rf ri_dir
-  end
-
-end
-
Index: lib/rubygems/custom_require.rb
===================================================================
--- lib/rubygems/custom_require.rb	(revision 37975)
+++ lib/rubygems/custom_require.rb	(revision 37976)
@@ -1,69 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-module Kernel
-
-  if defined?(gem_original_require) then
-    # Ruby ships with a custom_require, override its require
-    remove_method :require
-  else
-    ##
-    # The Kernel#require from before RubyGems was loaded.
-
-    alias gem_original_require require
-    private :gem_original_require
-  end
-
-  ##
-  # When RubyGems is required, Kernel#require is replaced with our own which
-  # is capable of loading gems on demand.
-  #
-  # When you call <tt>require 'x'</tt>, this is what happens:
-  # * If the file can be loaded from the existing Ruby loadpath, it
-  #   is.
-  # * Otherwise, installed gems are searched for a file that matches.
-  #   If it's found in gem 'y', that gem is activated (added to the
-  #   loadpath).
-  #
-  # The normal <tt>require</tt> functionality of returning false if
-  # that file has already been loaded is preserved.
-
-  def require path
-    if Gem.unresolved_deps.empty? then
-      gem_original_require path
-    else
-      spec = Gem::Specification.find { |s|
-        s.activated? and s.contains_requirable_file? path
-      }
-
-      unless spec then
-        found_specs = Gem::Specification.find_in_unresolved path
-        unless found_specs.empty? then
-          found_specs = [found_specs.last]
-        else
-          found_specs = Gem::Specification.find_in_unresolved_tree path
-        end
-
-        found_specs.each do |found_spec|
-          found_spec.activate
-        end
-      end
-
-      return gem_original_require path
-    end
-  rescue LoadError => load_error
-    if load_error.message.start_with?("Could not find") or
-        (load_error.message.end_with?(path) and Gem.try_activate(path)) then
-      return gem_original_require(path)
-    end
-
-    raise load_error
-  end
-
-  private :require
-
-end
-
Index: lib/rubygems/require_paths_builder.rb
===================================================================
--- lib/rubygems/require_paths_builder.rb	(revision 37975)
+++ lib/rubygems/require_paths_builder.rb	(revision 37976)
@@ -1,18 +0,0 @@
-require 'rubygems'
-
-# TODO: remove after 1.9.1 dropped
-module Gem::RequirePathsBuilder
-  def write_require_paths_file_if_needed(spec = @spec, gem_home = @gem_home)
-    return if spec.require_paths == ["lib"] &&
-              (spec.bindir.nil? || spec.bindir == "bin")
-    file_name = File.join(gem_home, 'gems', "#{@spec.full_name}", ".require_paths")
-    file_name.untaint
-    File.open(file_name, "w") do |file|
-      spec.require_paths.each do |path|
-        file.puts path
-      end
-      file.puts spec.bindir if spec.bindir
-    end
-  end
-end if Gem::QUICKLOADER_SUCKAGE
-
Index: lib/rubygems/source_index.rb
===================================================================
--- lib/rubygems/source_index.rb	(revision 37975)
+++ lib/rubygems/source_index.rb	(revision 37976)
@@ -1,406 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-require 'rubygems/specification'
-require 'rubygems/deprecate'
-
-##
-# The SourceIndex object indexes all the gems available from a
-# particular source (e.g. a list of gem directories, or a remote
-# source).  A SourceIndex maps a gem full name to a gem
-# specification.
-#
-# NOTE:: The class used to be named Cache, but that became
-#        confusing when cached source fetchers where introduced. The
-#        constant Gem::Cache is an alias for this class to allow old
-#        YAMLized source index objects to load properly.
-
-class Gem::SourceIndex
-
-  include Enumerable
-
-  attr_reader :gems # :nodoc:
-
-  ##
-  # Directories to use to refresh this SourceIndex when calling refresh!
-
-  attr_accessor :spec_dirs
-
-  ##
-  # Factory method to construct a source index instance for a given
-  # path.
-  #
-  # deprecated::
-  #   If supplied, from_installed_gems will act just like (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]