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

ruby-changes:27748

From: nagachika <ko1@a...>
Date: Mon, 18 Mar 2013 00:07:11 +0900 (JST)
Subject: [ruby-changes:27748] nagachika:r39800 (ruby_2_0_0): merge revision(s) 39621,39622: [Backport #7991]

nagachika	2013-03-18 00:07:00 +0900 (Mon, 18 Mar 2013)

  New Revision: 39800

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

  Log:
    merge revision(s) 39621,39622: [Backport #7991]
    
    * lib/rubygems/commands/setup_command.rb:  Install .pem files.
    
    * test/rubygems/test_gem_commands_setup_command.rb:  Test for the
      above.
    
    * lib/rubygems/spec_fetcher.rb:  Test HTTPS upgrade with URI::HTTPS,
      not URI::HTTP.  Fixes bug in automatic HTTPS upgrade.
    
    * test/rubygems/test_gem_spec_fetcher.rb:  Test for the above.
    
    * lib/rubygems.rb:  Version 2.0.2
    
    * lib/rubygems/test_utilities.rb:  Ensure scheme and uri class match.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/rubygems/commands/setup_command.rb
    branches/ruby_2_0_0/lib/rubygems/spec_fetcher.rb
    branches/ruby_2_0_0/lib/rubygems/test_utilities.rb
    branches/ruby_2_0_0/lib/rubygems.rb
    branches/ruby_2_0_0/test/rubygems/test_gem_commands_setup_command.rb
    branches/ruby_2_0_0/test/rubygems/test_gem_spec_fetcher.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 39799)
+++ ruby_2_0_0/ChangeLog	(revision 39800)
@@ -1,3 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Mon Mar 18 00:05:50 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems/commands/setup_command.rb:  Install .pem files.
+	* test/rubygems/test_gem_commands_setup_command.rb:  Test for the
+	  above.
+
+	* lib/rubygems/spec_fetcher.rb:  Test HTTPS upgrade with URI::HTTPS,
+	  not URI::HTTP.  Fixes bug in automatic HTTPS upgrade.
+	* test/rubygems/test_gem_spec_fetcher.rb:  Test for the above.
+
+	* lib/rubygems.rb:  Version 2.0.2
+
+	* lib/rubygems/test_utilities.rb:  Ensure scheme and uri class match.
+
 Mon Mar 18 00:03:27 2013  Eric Hodel  <drbrain@s...>
 
 	* test/rubygems/test_require.rb:  Fix tests when 'a.rb' exists.
Index: ruby_2_0_0/lib/rubygems/spec_fetcher.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/spec_fetcher.rb	(revision 39799)
+++ ruby_2_0_0/lib/rubygems/spec_fetcher.rb	(revision 39800)
@@ -241,7 +241,13 @@ class Gem::SpecFetcher https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/spec_fetcher.rb#L241
     https_uri.scheme = 'https'
     https_uri += '/'
 
-    Gem::RemoteFetcher.fetcher.fetch_path https_uri, nil, true
+    https_uri = URI https_uri.to_s # cast to URI::HTTPS
+
+    begin
+      Gem::RemoteFetcher.fetcher.fetch_path https_uri, nil, true
+    rescue Gem::RemoteFetcher::FetchError => e
+      raise unless e.message =~ / Not Allowed 405 /
+    end
 
     say "Upgraded #{uri} to HTTPS"
 
Index: ruby_2_0_0/lib/rubygems/commands/setup_command.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/commands/setup_command.rb	(revision 39799)
+++ ruby_2_0_0/lib/rubygems/commands/setup_command.rb	(revision 39800)
@@ -77,6 +77,8 @@ class Gem::Commands::SetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/setup_command.rb#L77
 
       options[:document].uniq!
     end
+
+    @verbose = nil
   end
 
   def check_ruby_version
@@ -279,18 +281,27 @@ TEXT https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/setup_command.rb#L281
     end
   end
 
+  def install_file file, dest_dir
+    dest_file = File.join dest_dir, file
+    dest_dir = File.dirname dest_file
+    mkdir_p dest_dir unless File.directory? dest_dir
+
+    install file, dest_file, :mode => 0644
+  end
+
   def install_lib(lib_dir)
     say "Installing RubyGems" if @verbose
 
     lib_files = rb_files_in 'lib'
+    pem_files = pem_files_in 'lib'
 
     Dir.chdir 'lib' do
       lib_files.each do |lib_file|
-        dest_file = File.join lib_dir, lib_file
-        dest_dir = File.dirname dest_file
-        mkdir_p dest_dir unless File.directory? dest_dir
+        install_file lib_file, lib_dir
+      end
 
-        install lib_file, dest_file, :mode => 0644
+      pem_files.each do |pem_file|
+        install_file pem_file, lib_dir
       end
     end
   end
@@ -381,6 +392,12 @@ TEXT https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/commands/setup_command.rb#L392
     [lib_dir, bin_dir]
   end
 
+  def pem_files_in dir
+    Dir.chdir dir do
+      Dir[File.join('**', '*pem')]
+    end
+  end
+
   def rb_files_in dir
     Dir.chdir dir do
       Dir[File.join('**', '*rb')]
Index: ruby_2_0_0/lib/rubygems/test_utilities.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/test_utilities.rb	(revision 39799)
+++ ruby_2_0_0/lib/rubygems/test_utilities.rb	(revision 39800)
@@ -38,6 +38,11 @@ class Gem::FakeFetcher https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/test_utilities.rb#L38
   end
 
   def find_data(path)
+    if URI === path and "URI::#{path.scheme.upcase}" != path.class.name then
+      raise ArgumentError,
+        "mismatch for scheme #{path.scheme} and class #{path.class}"
+    end
+
     path = path.to_s
     @paths << path
     raise ArgumentError, 'need full URI' unless path =~ %r'^https?://'
Index: ruby_2_0_0/lib/rubygems.rb
===================================================================
--- ruby_2_0_0/lib/rubygems.rb	(revision 39799)
+++ ruby_2_0_0/lib/rubygems.rb	(revision 39800)
@@ -8,7 +8,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems.rb#L8
 require 'rbconfig'
 
 module Gem
-  VERSION = '2.0.1'
+  VERSION = '2.0.2'
 end
 
 # Must be first since it unloads the prelude from 1.9.2
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 39799)
+++ ruby_2_0_0/version.h	(revision 39800)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-03-18"
-#define RUBY_PATCHLEVEL 69
+#define RUBY_PATCHLEVEL 70
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_0_0/test/rubygems/test_gem_spec_fetcher.rb
===================================================================
--- ruby_2_0_0/test/rubygems/test_gem_spec_fetcher.rb	(revision 39799)
+++ ruby_2_0_0/test/rubygems/test_gem_spec_fetcher.rb	(revision 39800)
@@ -287,5 +287,30 @@ Upgraded http://rubygems.org to HTTPS https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_spec_fetcher.rb#L287
     assert_equal expected, @ui.output
   end
 
+  def test_upgrade_http_source_rubygems_405
+    Gem.configuration.verbose = :really
+
+    source       = Gem::Source.new URI 'http://rubygems.org'
+    https_source = nil
+
+    @fetcher.data['https://rubygems.org/'] = proc do
+      raise Gem::RemoteFetcher::FetchError.new ' Not Allowed 405 ', nil
+    end
+
+    use_ui @ui do
+      https_source = @sf.upgrade_http_source source
+    end
+
+    assert_equal URI('https://rubygems.org'), https_source.uri
+
+    assert_empty @ui.error
+
+    expected = <<-EXPECTED
+Upgraded http://rubygems.org to HTTPS
+    EXPECTED
+
+    assert_equal expected, @ui.output
+  end
+
 end
 
Index: ruby_2_0_0/test/rubygems/test_gem_commands_setup_command.rb
===================================================================
--- ruby_2_0_0/test/rubygems/test_gem_commands_setup_command.rb	(revision 39799)
+++ ruby_2_0_0/test/rubygems/test_gem_commands_setup_command.rb	(revision 39800)
@@ -11,11 +11,17 @@ class TestGemCommandsSetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_commands_setup_command.rb#L11
     @cmd.options[:prefix] = @install_dir
 
     FileUtils.mkdir_p 'bin'
-    FileUtils.mkdir_p 'lib/rubygems'
+    FileUtils.mkdir_p 'lib/rubygems/ssl_certs'
 
     open 'bin/gem',                   'w' do |io| io.puts '# gem'          end
     open 'lib/rubygems.rb',           'w' do |io| io.puts '# rubygems.rb'  end
     open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
+    open 'lib/rubygems/ssl_certs/foo.pem', 'w' do |io| io.puts 'PEM'       end
+  end
+
+  def test_pem_files_in
+    assert_equal %w[rubygems/ssl_certs/foo.pem],
+                 @cmd.pem_files_in('lib').sort
   end
 
   def test_rb_files_in
@@ -23,6 +29,17 @@ class TestGemCommandsSetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_commands_setup_command.rb#L29
                  @cmd.rb_files_in('lib').sort
   end
 
+  def test_install_lib
+    @cmd.extend FileUtils
+
+    Dir.mktmpdir 'lib' do |dir|
+      @cmd.install_lib dir
+
+      assert_path_exists File.join(dir, 'rubygems.rb')
+      assert_path_exists File.join(dir, 'rubygems/ssl_certs/foo.pem')
+    end
+  end
+
   def test_remove_old_lib_files
     lib            = File.join @install_dir, 'lib'
     lib_rubygems   = File.join lib, 'rubygems'

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39621-39622


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

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