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

ruby-changes:29791

From: drbrain <ko1@a...>
Date: Tue, 9 Jul 2013 07:41:22 +0900 (JST)
Subject: [ruby-changes:29791] drbrain:r41843 (trunk): * lib/rubygems: Update to RubyGems 2.0.4. See

drbrain	2013-07-09 07:41:03 +0900 (Tue, 09 Jul 2013)

  New Revision: 41843

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

  Log:
    * lib/rubygems:  Update to RubyGems 2.0.4.  See
      https://github.com/rubygems/rubygems/blob/2.0/History.txt for changes

  Removed files:
    trunk/test/rubygems/test_gem_commands_search_command.rb
  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/commands/help_command.rb
    trunk/lib/rubygems/commands/list_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/search_command.rb
    trunk/lib/rubygems/commands/setup_command.rb
    trunk/lib/rubygems/commands/specification_command.rb
    trunk/lib/rubygems/commands/update_command.rb
    trunk/lib/rubygems/core_ext/kernel_require.rb
    trunk/lib/rubygems/defaults.rb
    trunk/lib/rubygems/dependency_installer.rb
    trunk/lib/rubygems/dependency_resolver.rb
    trunk/lib/rubygems/errors.rb
    trunk/lib/rubygems/gemcutter_utilities.rb
    trunk/lib/rubygems/installer.rb
    trunk/lib/rubygems/package.rb
    trunk/lib/rubygems/platform.rb
    trunk/lib/rubygems/specification.rb
    trunk/lib/rubygems.rb
    trunk/test/rubygems/test_gem.rb
    trunk/test/rubygems/test_gem_commands_help_command.rb
    trunk/test/rubygems/test_gem_commands_owner_command.rb
    trunk/test/rubygems/test_gem_commands_push_command.rb
    trunk/test/rubygems/test_gem_commands_setup_command.rb
    trunk/test/rubygems/test_gem_gemcutter_utilities.rb
    trunk/test/rubygems/test_gem_installer.rb
    trunk/test/rubygems/test_gem_package.rb
    trunk/test/rubygems/test_gem_spec_fetcher.rb
    trunk/test/rubygems/test_gem_specification.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41842)
+++ ChangeLog	(revision 41843)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul  9 07:39:45 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems:  Update to RubyGems 2.0.4.  See
+	  https://github.com/rubygems/rubygems/blob/2.0/History.txt for changes
+
 Tue Jul  9 01:47:16 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (biglsh_bang): Don't shift a BDIGIT with BITSPERDIG bits.
Index: lib/rubygems/gemcutter_utilities.rb
===================================================================
--- lib/rubygems/gemcutter_utilities.rb	(revision 41842)
+++ lib/rubygems/gemcutter_utilities.rb	(revision 41843)
@@ -38,7 +38,7 @@ module Gem::GemcutterUtilities https://github.com/ruby/ruby/blob/trunk/lib/rubygems/gemcutter_utilities.rb#L38
 
     say "Enter your #{pretty_host} credentials."
     say "Don't have an account yet? " +
-        "Create one at https://#{sign_in_host}/sign_up"
+        "Create one at #{sign_in_host}/sign_up"
 
     email    =              ask "   Email: "
     password = ask_for_password "Password: "
@@ -60,7 +60,14 @@ module Gem::GemcutterUtilities https://github.com/ruby/ruby/blob/trunk/lib/rubygems/gemcutter_utilities.rb#L60
     configured_host = Gem.host unless
       Gem.configuration.disable_default_gem_server
 
-    @host ||= ENV['RUBYGEMS_HOST'] || configured_host
+    @host ||=
+      begin
+        env_rubygems_host = ENV['RUBYGEMS_HOST']
+        env_rubygems_host = nil if
+          env_rubygems_host and env_rubygems_host.empty?
+
+        env_rubygems_host|| configured_host
+      end
   end
 
   def rubygems_api_request(method, path, host = nil, &block)
@@ -79,7 +86,7 @@ module Gem::GemcutterUtilities https://github.com/ruby/ruby/blob/trunk/lib/rubygems/gemcutter_utilities.rb#L86
     Gem::RemoteFetcher.fetcher.request(uri, request_method, &block)
   end
 
-  def with_response(resp)
+  def with_response resp, error_prefix = nil
     case resp
     when Net::HTTPSuccess then
       if block_given? then
@@ -88,7 +95,10 @@ module Gem::GemcutterUtilities https://github.com/ruby/ruby/blob/trunk/lib/rubygems/gemcutter_utilities.rb#L95
         say resp.body
       end
     else
-      say resp.body
+      message = resp.body
+      message = "#{error_prefix}: #{message}" if error_prefix
+
+      say message
       terminate_interaction 1 # TODO: question this
     end
   end
Index: lib/rubygems/dependency_installer.rb
===================================================================
--- lib/rubygems/dependency_installer.rb	(revision 41842)
+++ lib/rubygems/dependency_installer.rb	(revision 41843)
@@ -63,7 +63,6 @@ class Gem::DependencyInstaller https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_installer.rb#L63
       # HACK shouldn't change the global settings, needed for -i behavior
       # maybe move to the install command?  See also github #442
       Gem::Specification.dirs = @install_dir
-      Gem.ensure_gem_subdirectories @install_dir
     end
 
     options = DEFAULT_OPTIONS.merge options
Index: lib/rubygems/dependency_resolver.rb
===================================================================
--- lib/rubygems/dependency_resolver.rb	(revision 41842)
+++ lib/rubygems/dependency_resolver.rb	(revision 41843)
@@ -349,7 +349,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_resolver.rb#L349
         when Dependency
           @dependency == other
         when DependencyRequest
-          @dependency == other.dep && @requester == other.requester
+          @dependency == other.dependency && @requester == other.requester
         else
           false
         end
Index: lib/rubygems/core_ext/kernel_require.rb
===================================================================
--- lib/rubygems/core_ext/kernel_require.rb	(revision 41842)
+++ lib/rubygems/core_ext/kernel_require.rb	(revision 41843)
@@ -4,6 +4,8 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_require.rb#L4
 # See LICENSE.txt for permissions.
 #++
 
+require 'monitor'
+
 module Kernel
 
   if defined?(gem_original_require) then
@@ -31,7 +33,11 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_require.rb#L33
   # The normal <tt>require</tt> functionality of returning false if
   # that file has already been loaded is preserved.
 
+  ACTIVATION_MONITOR = Monitor.new
+
   def require path
+    ACTIVATION_MONITOR.enter
+
     spec = Gem.find_unresolved_default_spec(path)
     if spec
       Gem.remove_unresolved_default_spec(spec)
@@ -111,6 +117,8 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_require.rb#L117
     end
 
     raise load_error
+  ensure
+    ACTIVATION_MONITOR.exit
   end
 
   private :require
Index: lib/rubygems/errors.rb
===================================================================
--- lib/rubygems/errors.rb	(revision 41842)
+++ lib/rubygems/errors.rb	(revision 41843)
@@ -62,10 +62,10 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/errors.rb#L62
     ##
     # A wordy description of the error.
     def wordy
-      "Found %s (%), but was for platform%s %s" %
+      "Found %s (%s), but was for platform%s %s" %
         [@name,
          @version,
-         @platforms.size == 1 ? 's' : '',
+         @platforms.size == 1 ? '' : 's',
          @platforms.join(' ,')]
     end
   end
Index: lib/rubygems/specification.rb
===================================================================
--- lib/rubygems/specification.rb	(revision 41842)
+++ lib/rubygems/specification.rb	(revision 41843)
@@ -5,6 +5,17 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L5
 # See LICENSE.txt for permissions.
 #++
 
+require 'rubygems/version'
+require 'rubygems/requirement'
+require 'rubygems/platform'
+require 'rubygems/deprecate'
+
+# :stopdoc:
+# date.rb can't be loaded for `make install` due to miniruby
+# Date is needed for old gems that stored #date as Date instead of Time.
+class Date; end
+# :startdoc:
+
 ##
 # The Specification class contains the information for a Gem.  Typically
 # defined in a .gemspec file or a Rakefile, and looks like this:
@@ -20,32 +31,19 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L31
 #     s.homepage    = 'https://rubygems.org/gems/example'
 #   end
 #
-#   Starting in RubyGems 1.9.0, a Specification can hold arbitrary
-#   metadata. This metadata is accessed via Specification#metadata
-#   and has the following restrictions:
+# Starting in RubyGems 1.9.0, a Specification can hold arbitrary
+# metadata. This metadata is accessed via Specification#metadata
+# and has the following restrictions:
 #
-#     * Must be a Hash object
-#     * All keys and values must be Strings
-#     * Keys can be a maximum of 128 bytes and values can be a
-#       maximum of 1024 bytes
-#     * All strings must be UTF8, no binary data is allowed
+# * Must be a Hash object
+# * All keys and values must be Strings
+# * Keys can be a maximum of 128 bytes and values can be a
+#   maximum of 1024 bytes
+# * All strings must be UTF8, no binary data is allowed
 #
-#   For example, to add metadata for the location of a bugtracker:
+# For example, to add metadata for the location of a bugtracker:
 #
 #   s.metadata = { "bugtracker" => "http://somewhere.com/blah" }
-#
-
-
-require 'rubygems/version'
-require 'rubygems/requirement'
-require 'rubygems/platform'
-require 'rubygems/deprecate'
-
-# :stopdoc:
-# date.rb can't be loaded for `make install` due to miniruby
-# Date is needed for old gems that stored #date as Date instead of Time.
-class Date; end
-# :startdoc:
 
 class Gem::Specification
 
@@ -918,7 +916,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L916
     result = Hash.new { |h,k| h[k] = {} }
     native = {}
 
-    Gem::Specification._all.reverse_each do |spec|
+    Gem::Specification.reverse_each do |spec|
       next if spec.version.prerelease? unless prerelease
 
       native[spec.name] = spec.version if spec.platform == Gem::Platform::RUBY
@@ -995,7 +993,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L993
     # TODO: maybe we should switch to rubygems' version service?
     fetcher = Gem::SpecFetcher.fetcher
 
-    latest_specs.each do |local|
+    latest_specs(true).each do |local|
       dependency = Gem::Dependency.new local.name, ">= #{local.version}"
       remotes, _   = fetcher.search_for_dependency dependency
       remotes      = remotes.map { |n, _| n.version }
@@ -1236,7 +1234,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1234
 
     unless dependency.respond_to?(:name) &&
            dependency.respond_to?(:version_requirements)
-      dependency = Gem::Dependency.new(dependency, requirements, type)
+      dependency = Gem::Dependency.new(dependency.to_s, requirements, type)
     end
 
     dependencies << dependency
@@ -2270,7 +2268,7 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L2268
         require 'rubygems/psych_tree'
       end
 
-      builder = Gem::NoAliasYAMLTree.create
+      builder = Gem::NoAliasYAMLTree.new({})
       builder << self
       ast = builder.tree
 
Index: lib/rubygems/platform.rb
===================================================================
--- lib/rubygems/platform.rb	(revision 41842)
+++ lib/rubygems/platform.rb	(revision 41843)
@@ -74,6 +74,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/lib/rubygems/platform.rb#L74
                       when /hpux(\d+)?/ then            [ 'hpux',      $1  ]
                       when /^java$/, /^jruby$/ then     [ 'java',      nil ]
                       when /^java([\d.]*)/ then         [ 'java',      $1  ]
+                      when /^dalvik(\d+)?$/ then        [ 'dalvik',    $1  ]
                       when /^dotnet$/ then              [ 'dotnet',    nil ]
                       when /^dotnet([\d.]*)/ then       [ 'dotnet',    $1  ]
                       when /linux/ then                 [ 'linux',     $1  ]
@@ -155,6 +156,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/lib/rubygems/platform.rb#L156
               when /^i686-darwin(\d)/     then ['x86',       'darwin',  $1    ]
               when /^i\d86-linux/         then ['x86',       'linux',   nil   ]
               when 'java', 'jruby'        then [nil,         'java',    nil   ]
+              when /^dalvik(\d+)?$/       then [nil,         'dalvik',  $1    ]
               when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet',  $2    ]
               when /mswin32(\_(\d+))?/    then ['x86',       'mswin32', $2    ]
               when 'powerpc-darwin'       then ['powerpc',   'darwin',  nil   ]
Index: lib/rubygems/package.rb
===================================================================
--- lib/rubygems/package.rb	(revision 41842)
+++ lib/rubygems/package.rb	(revision 41843)
@@ -336,7 +336,6 @@ EOM https://github.com/ruby/ruby/blob/trunk/lib/rubygems/package.rb#L336
 
         open destination, 'wb', entry.header.mode do |out|
           out.write entry.read
-          out.fsync rescue nil # for filesystems without fsync(2)
         end
 
         say destination if Gem.configuration.really_verbose
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb	(revision 41842)
+++ lib/rubygems/installer.rb	(revision 41843)
@@ -331,8 +331,9 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L331
   # specifications directory.
 
   def write_spec
-    File.open(spec_file, "w") do |file|
+    open spec_file, 'w' do |file|
       file.puts spec.to_ruby_for_cache
+      file.fsync rescue nil # for filesystems without fsync(2)
     end
   end
 
@@ -773,7 +774,13 @@ EOF https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L774
   def write_build_info_file
     return if @build_args.empty?
 
-    open spec.build_info_file, 'w' do |io|
+    build_info_dir = File.join gem_home, 'build_info'
+
+    FileUtils.mkdir_p build_info_dir
+
+    build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
+
+    open build_info_file, 'w' do |io|
       @build_args.each do |arg|
         io.puts arg
       end
Index: lib/rubygems/commands/push_command.rb
===================================================================
--- lib/rubygems/commands/push_command.rb	(revision 41842)
+++ lib/rubygems/commands/push_command.rb	(revision 41843)
@@ -20,7 +20,8 @@ class Gem::Commands::PushCommand < Gem:: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/push_command.rb#L20
   end
 
   def initialize
-    super 'push', description
+    super 'push', description, :host => self.host
+
     add_proxy_option
     add_key_option
 
Index: lib/rubygems/commands/specification_command.rb
===================================================================
--- lib/rubygems/commands/specification_command.rb	(revision 41842)
+++ lib/rubygems/commands/specification_command.rb	(revision 41843)
@@ -28,7 +28,7 @@ class Gem::Commands::SpecificationComman https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/specification_command.rb#L28
       options[:format] = :ruby
     end
 
-    add_option('--yaml', 'Output RUBY format') do |value, options|
+    add_option('--yaml', 'Output YAML format') do |value, options|
       options[:format] = :yaml
     end
 
Index: lib/rubygems/commands/update_command.rb
===================================================================
--- lib/rubygems/commands/update_command.rb	(revision 41842)
+++ lib/rubygems/commands/update_command.rb	(revision 41843)
@@ -94,7 +94,7 @@ class Gem::Commands::UpdateCommand < Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/update_command.rb#L94
 
     say "Updating #{name}"
     begin
-      @installer.install name, version
+      @installer.install name, Gem::Requirement.new(version)
       success = true
     rescue Gem::InstallError => e
       alert_error "Error installing #{name}:\n\t#{e.message}"
Index: lib/rubygems/commands/help_command.rb
===================================================================
--- lib/rubygems/commands/help_command.rb	(revision 41842)
+++ lib/rubygems/commands/help_command.rb	(revision 41843)
@@ -113,7 +113,15 @@ platform. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/help_command.rb#L113
       format = "#{' ' * margin_width}%-#{desc_width}s%s"
 
       command_manager.command_names.each do |cmd_name|
-        summary = command_manager[cmd_name].summary
+        command = command_manager[cmd_name]
+
+        summary =
+          if command then
+            command.summary
+          else
+            "[No command found for #{cmd_name}, bug?]"
+          end
+
         summary = wrap(summary, summary_width).split "\n"
         out << sprintf(format, cmd_name, summary.shift)
         until summary.empty? do
Index: lib/rubygems/commands/owner_command.rb
===================================================================
--- lib/rubygems/commands/owner_command.rb	(revision 41842)
+++ lib/rubygems/commands/owner_command.rb	(revision 41843)
@@ -73,7 +73,7 @@ class Gem::Commands::OwnerCommand < Gem: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/owner_command.rb#L73
           request.add_field "Authorization", api_key
         end
 
-        with_response response
+        with_response response, "Removing #{owner}"
       rescue
         # ignore
       end
Index: lib/rubygems/commands/pristine_command.rb
===================================================================
--- lib/rubygems/commands/pristine_command.rb	(revision 41842)
+++ lib/rubygems/commands/pristine_command.rb	(revision 41843)
@@ -10,7 +10,8 @@ class Gem::Commands::PristineCommand < G https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/pristine_command.rb#L10
   def initialize
     super 'pristine',
           'Restores installed gems to pristine condition from files located in the gem cache',
-          :version => Gem::Requirement.default, :extensions => true,
+          :version => Gem::Requirement.default,
+          :extensions => true,
           :all => false
 
     add_option('--all',
@@ -37,7 +38,7 @@ class Gem::Commands::PristineCommand < G https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/pristine_command.rb#L38
   end
 
   def defaults_str # :nodoc:
-    "--all --extensions"
+    '--extensions'
   end
 
   def description # :nodoc:
@@ -52,8 +53,8 @@ for the gem are regenerated. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/pristine_command.rb#L53
 If the cached gem cannot be found, you will need to use `gem install` to
 revert the gem.
 
-If --no-extensions is provided pristine will not attempt to restore gems with
-extensions.
+If --no-extensions is provided pristine will not attempt to restore gems
+with extensions.
     EOF
   end
 
Index: lib/rubygems/commands/setup_command.rb
===================================================================
--- lib/rubygems/commands/setup_command.rb	(revision 41842)
+++ lib/rubygems/commands/setup_command.rb	(revision 41843)
@@ -159,29 +159,7 @@ By default, this RubyGems will install g https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/setup_command.rb#L159
 
     options[:previous_version] = Gem::Version.new(options[:previous_version])
 
-    release_notes = File.join Dir.pwd, 'History.txt'
-
-    release_notes = if File.exist? release_notes then
-                      history = File.read release_notes
-                      history = history.sub(/^# coding:.*?^=/m, '')
-
-                      text = history.split(HISTORY_HEADER)
-                      text.shift # correct an off-by-one generated by split
-                      version_lines = history.scan(HISTORY_HEADER)
-                      versions = history.scan(VERSION_MATCHER).flatten.map { |x| Gem::Version.new(x) }
-
-                      history_string = ""
-
-                      until versions.length == 0 or versions.shift < options[:previous_version]
-                        history_string += version_lines.shift + text.shift
-                      end
-
-                      history_string
-                    else
-                      "Oh-no! Unable to find release notes!"
-                    end
-
-    say release_notes
+    show_release_notes
 
     say
     say "-" * 78
@@ -458,6 +436,40 @@ abort "#{deprecation_message}" https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/setup_command.rb#L436
     end
   end
 
+  def show_release_notes
+    release_notes = File.join Dir.pwd, 'History.txt'
+
+    release_notes =
+      if File.exist? release_notes then
+        history = File.read release_notes
+
+        history.force_encoding Encoding::UTF_8 if
+          Object.const_defined? :Encoding
+
+        history = history.sub(/^# coding:.*?^=/m, '')
+
+        text = history.split(HISTORY_HEADER)
+        text.shift # correct an off-by-one generated by split
+        version_lines = history.scan(HISTORY_HEADER)
+        versions = history.scan(VERSION_MATCHER).flatten.map do |x|
+          Gem::Version.new(x)
+        end
+
+        history_string = ""
+
+        until versions.length == 0 or
+              versions.shift < options[:previous_version] do
+          history_string += version_lines.shift + text.shift
+        end
+
+        history_string
+      else
+        "Oh-no! Unable to find release notes!"
+      end
+
+    say release_notes
+  end
+
   def uninstall_old_gemcutter
     require 'rubygems/uninstaller'
 
Index: lib/rubygems/commands/search_command.rb
===================================================================
--- lib/rubygems/com (... truncated)

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

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