ruby-changes:29024
From: drbrain <ko1@a...>
Date: Wed, 5 Jun 2013 06:55:14 +0900 (JST)
Subject: [ruby-changes:29024] drbrain:r41076 (trunk): * lib/rubygems: Update to RubyGems 2.0.3
drbrain 2013-06-05 06:54:58 +0900 (Wed, 05 Jun 2013) New Revision: 41076 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41076 Log: * lib/rubygems: Update to RubyGems 2.0.3 * test/rubygems: Tests for the above. * NEWS: Added RubyGems 2.0.3 note. Modified files: trunk/ChangeLog trunk/NEWS trunk/lib/rubygems/commands/cert_command.rb trunk/lib/rubygems/commands/list_command.rb trunk/lib/rubygems/defaults.rb trunk/lib/rubygems/security/signer.rb trunk/lib/rubygems/test_case.rb trunk/lib/rubygems.rb trunk/test/rubygems/test_gem_commands_cert_command.rb trunk/test/rubygems/test_gem_installer.rb trunk/test/rubygems/test_gem_package.rb trunk/test/rubygems/test_gem_security_signer.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 41075) +++ ChangeLog (revision 41076) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Jun 5 06:44:08 2013 Eric Hodel <drbrain@s...> + + * lib/rubygems: Update to RubyGems 2.0.3 + + * test/rubygems: Tests for the above. + + * NEWS: Added RubyGems 2.0.3 note. + Wed Jun 5 06:35:15 2013 Eric Hodel <drbrain@s...> * doc/marshal.rdoc: Add description of Marshal format. Index: lib/rubygems/commands/cert_command.rb =================================================================== --- lib/rubygems/commands/cert_command.rb (revision 41075) +++ lib/rubygems/commands/cert_command.rb (revision 41076) @@ -180,7 +180,7 @@ For further reading on signing gems see https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/cert_command.rb#L180 end def load_default_cert - cert_file = File.join Gem.user_home, 'gem-public_cert.pem' + cert_file = File.join Gem.default_cert_path cert = File.read cert_file options[:issuer_cert] = OpenSSL::X509::Certificate.new cert rescue Errno::ENOENT @@ -196,7 +196,7 @@ For further reading on signing gems see https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/cert_command.rb#L196 end def load_default_key - key_file = File.join Gem.user_home, 'gem-private_key.pem' + key_file = File.join Gem.default_key_path key = File.read key_file options[:key] = OpenSSL::PKey::RSA.new key rescue Errno::ENOENT Index: lib/rubygems/commands/list_command.rb =================================================================== --- lib/rubygems/commands/list_command.rb (revision 41075) +++ lib/rubygems/commands/list_command.rb (revision 41076) @@ -3,7 +3,7 @@ require 'rubygems/commands/query_command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/list_command.rb#L3 ## # An alternate to Gem::Commands::QueryCommand that searches for gems starting -# with the supplied argument. +# with the the supplied argument. class Gem::Commands::ListCommand < Gem::Commands::QueryCommand Index: lib/rubygems/security/signer.rb =================================================================== --- lib/rubygems/security/signer.rb (revision 41075) +++ lib/rubygems/security/signer.rb (revision 41076) @@ -34,12 +34,12 @@ class Gem::Security::Signer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/security/signer.rb#L34 @key = key unless @key then - default_key = File.join Gem.user_home, 'gem-private_key.pem' + default_key = File.join Gem.default_key_path @key = default_key if File.exist? default_key end unless @cert_chain then - default_cert = File.join Gem.user_home, 'gem-public_cert.pem' + default_cert = File.join Gem.default_cert_path @cert_chain = [default_cert] if File.exist? default_cert end @@ -110,15 +110,15 @@ class Gem::Security::Signer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/security/signer.rb#L110 def re_sign_key # :nodoc: old_cert = @cert_chain.last - disk_cert_path = File.join Gem.user_home, 'gem-public_cert.pem' + disk_cert_path = File.join Gem.default_cert_path disk_cert = File.read disk_cert_path rescue nil disk_key = - File.read File.join(Gem.user_home, 'gem-private_key.pem') rescue nil + File.read File.join(Gem.default_key_path) rescue nil if disk_key == @key.to_pem and disk_cert == old_cert.to_pem then expiry = old_cert.not_after.strftime '%Y%m%d%H%M%S' old_cert_file = "gem-public_cert.pem.expired.#{expiry}" - old_cert_path = File.join Gem.user_home, old_cert_file + old_cert_path = File.join Gem.user_home, ".gem", old_cert_file unless File.exist? old_cert_path then Gem::Security.write old_cert, old_cert_path Index: lib/rubygems/defaults.rb =================================================================== --- lib/rubygems/defaults.rb (revision 41075) +++ lib/rubygems/defaults.rb (revision 41076) @@ -110,4 +110,18 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/defaults.rb#L110 'ruby' end end + + ## + # The default signing key path + + def self.default_key_path + File.join Gem.user_home, ".gem", "gem-private_key.pem" + end + + ## + # The default signing certificate chain path + + def self.default_cert_path + File.join Gem.user_home, ".gem", "gem-public_cert.pem" + end end Index: lib/rubygems/test_case.rb =================================================================== --- lib/rubygems/test_case.rb (revision 41075) +++ lib/rubygems/test_case.rb (revision 41076) @@ -1027,7 +1027,7 @@ Also, a list: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L1027 end ## - # Returns the path to the key named +key_name+ from <tt>test/rubygems/</tt> + # Returns the path tot he key named +key_name+ from <tt>test/rubygems</tt> def self.key_path key_name File.expand_path "../../../test/rubygems/#{key_name}_key.pem", __FILE__ Index: lib/rubygems.rb =================================================================== --- lib/rubygems.rb (revision 41075) +++ lib/rubygems.rb (revision 41076) @@ -8,7 +8,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L8 require 'rbconfig' module Gem - VERSION = '2.0.2' + VERSION = '2.0.3' end # Must be first since it unloads the prelude from 1.9.2 @@ -328,7 +328,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L328 end ## - # The path to the data directory specified by the gem name. If the + # The path the the data directory specified by the gem name. If the # package is not available as a gem, return nil. def self.datadir(gem_name) Index: NEWS =================================================================== --- NEWS (revision 41075) +++ NEWS (revision 41076) @@ -86,6 +86,11 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L86 * Rinda now supports multicast sockets. See Rinda::RingServer and Rinda::RingFinger for details. +* RubyGems + * Updated to 2.0.3. See + http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.3+%2F+2012-03-1 + for release notes. + * Socket * New methods: * Socket.getifaddrs Index: test/rubygems/test_gem_package.rb =================================================================== --- test/rubygems/test_gem_package.rb (revision 41075) +++ test/rubygems/test_gem_package.rb (revision 41076) @@ -162,10 +162,12 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L162 end def test_build_auto_signed - private_key_path = File.join Gem.user_home, 'gem-private_key.pem' + FileUtils.mkdir_p File.join(Gem.user_home, '.gem') + + private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem' Gem::Security.write PRIVATE_KEY, private_key_path - public_cert_path = File.join Gem.user_home, 'gem-public_cert.pem' + public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem' Gem::Security.write PUBLIC_CERT, public_cert_path spec = Gem::Specification.new 'build', '1' @@ -509,7 +511,7 @@ class TestGemPackage < Gem::Package::Tar https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_package.rb#L511 package.verify end - assert_match /\s-\snonexistent\.gem\z/, e.message + assert_match ' - nonexistent.gem', e.message end def test_verify_security_policy Index: test/rubygems/test_gem_commands_cert_command.rb =================================================================== --- test/rubygems/test_gem_commands_cert_command.rb (revision 41075) +++ test/rubygems/test_gem_commands_cert_command.rb (revision 41076) @@ -308,10 +308,12 @@ Removed '/CN=alternate/DC=example' https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_cert_command.rb#L308 end def test_execute_sign_default - private_key_path = File.join Gem.user_home, 'gem-private_key.pem' + FileUtils.mkdir_p File.join Gem.user_home, '.gem' + + private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem' Gem::Security.write PRIVATE_KEY, private_key_path - public_cert_path = File.join Gem.user_home, 'gem-public_cert.pem' + public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem' Gem::Security.write PUBLIC_CERT, public_cert_path path = File.join @tempdir, 'cert.pem' @@ -338,7 +340,9 @@ Removed '/CN=alternate/DC=example' https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_cert_command.rb#L340 end def test_execute_sign_no_cert - private_key_path = File.join Gem.user_home, 'gem-private_key.pem' + FileUtils.mkdir_p File.join Gem.user_home, '.gem' + + private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem' Gem::Security.write PRIVATE_KEY, private_key_path path = File.join @tempdir, 'cert.pem' @@ -364,7 +368,9 @@ ERROR: --certificate not specified and https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_cert_command.rb#L368 end def test_execute_sign_no_key - public_cert_path = File.join Gem.user_home, 'gem-public_cert.pem' + FileUtils.mkdir_p File.join Gem.user_home, '.gem' + + public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem' Gem::Security.write PUBLIC_CERT, public_cert_path path = File.join @tempdir, 'cert.pem' Index: test/rubygems/test_gem_installer.rb =================================================================== --- test/rubygems/test_gem_installer.rb (revision 41075) +++ test/rubygems/test_gem_installer.rb (revision 41076) @@ -1073,7 +1073,6 @@ gem 'other', version https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_installer.rb#L1073 CONFIG['CC'] = '$(TOUCH) $@ ||' CONFIG['LDSHARED'] = '$(TOUCH) $@ ||' - $ruby = '#{Gem.ruby}' create_makefile("#{@spec.name}") RUBY Index: test/rubygems/test_gem_security_signer.rb =================================================================== --- test/rubygems/test_gem_security_signer.rb (revision 41075) +++ test/rubygems/test_gem_security_signer.rb (revision 41076) @@ -50,10 +50,12 @@ class TestGemSecuritySigner < Gem::TestC https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_security_signer.rb#L50 end def test_initialize_default - private_key_path = File.join Gem.user_home, 'gem-private_key.pem' + FileUtils.mkdir_p File.join(Gem.user_home, '.gem') + + private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem' Gem::Security.write PRIVATE_KEY, private_key_path - public_cert_path = File.join Gem.user_home, 'gem-public_cert.pem' + public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem' Gem::Security.write PUBLIC_CERT, public_cert_path signer = Gem::Security::Signer.new nil, nil @@ -120,12 +122,12 @@ c7NM7KZZjj7G++SXjYTEI1PHSA7aFQ/i/+qSUvx+ https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_security_signer.rb#L122 end def test_sign_expired_auto_update - FileUtils.mkdir_p Gem.user_home, :mode => 0700 + FileUtils.mkdir_p File.join(Gem.user_home, '.gem'), :mode => 0700 - private_key_path = File.join(Gem.user_home, 'gem-private_key.pem') + private_key_path = File.join(Gem.user_home, '.gem', 'gem-private_key.pem') Gem::Security.write PRIVATE_KEY, private_key_path - cert_path = File.join Gem.user_home, 'gem-public_cert.pem' + cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem' Gem::Security.write EXPIRED_CERT, cert_path signer = Gem::Security::Signer.new PRIVATE_KEY, [EXPIRED_CERT] @@ -140,14 +142,14 @@ c7NM7KZZjj7G++SXjYTEI1PHSA7aFQ/i/+qSUvx+ https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_security_signer.rb#L142 expiry = EXPIRED_CERT.not_after.strftime "%Y%m%d%H%M%S" expired_path = - File.join Gem.user_home, "gem-public_cert.pem.expired.#{expiry}" + File.join Gem.user_home, '.gem', "gem-public_cert.pem.expired.#{expiry}" assert_path_exists expired_path assert_equal EXPIRED_CERT.to_pem, File.read(expired_path) end def test_sign_expired_auto_update_exists - FileUtils.mkdir_p Gem.user_home, :mode => 0700 + FileUtils.mkdir_p File.join(Gem.user_home, '.gem'), :mode => 0700 expiry = EXPIRED_CERT.not_after.strftime "%Y%m%d%H%M%S" expired_path = -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/