[DRE-maint] Ubuntu (new upstream) libgems-ruby 1.3.0~RC1-0ubuntu1

Ubuntu Merge-o-Matic mom at ubuntu.com
Wed Aug 27 19:38:08 UTC 2008


This e-mail has been sent due to an upload to Ubuntu of a new upstream
version which still contains Ubuntu changes.  It contains the difference
between the Ubuntu version and the equivalent base version in Debian, note
that this difference may include the upstream changes.
-------------- next part --------------
Format: 1.7
Date: Wed, 27 Aug 2008 12:40:08 -0400
Source: libgems-ruby
Binary: rubygems rubygems1.8 rubygems-doc rubygems1.9
Architecture: source
Version: 1.3.0~RC1-0ubuntu1
Distribution: intrepid
Urgency: low
Maintainer: Ubuntu MOTU Developers <ubuntu-motu at lists.ubuntu.com>
Changed-By: Mathias Gug <mathiaz at ubuntu.com>
Description: 
 rubygems   - package management framework for Ruby libraries/applications
 rubygems-doc - package management framework for Ruby libraries/applications
 rubygems1.8 - package management framework for Ruby libraries/applications
 rubygems1.9 - package management framework for Ruby libraries/applications
Launchpad-Bugs-Fixed: 145267
Changes: 
 libgems-ruby (1.3.0~RC1-0ubuntu1) intrepid; urgency=low
 .
   [ Neil Wilson ]
   * Make alternatives respond to verbose option.
   * Use a gem specific alternatives database.
   * Add rubygems default package that points at rubygems1.8
   * debian/patches: 40_make_update_system_run_apt_get - make
     'update --system' call apt-get. Replaces 03_disable_update_system.
   * Import from SVN to obtain hooks.
   * Use defaults/operating_system.rb to enforce Debian standards.
   * Use alternatives system to make gems available on PATH.
     Closes LP: #145267.
   * Move to CDBS simple patch system from dpatch.
   * Remove tight ruby1.9 build dependency to allow backports.
   * debian/patches: remove 21_avoid_ioseek - incorporated upstream.
   * debian/patches: remove 01_default_gem_path - replaced by
     debian/operating_system.rb.
   * debian/patches: remove 08_tighter_regex_search - upstream now uses
     a different search system that does not have the substring problem.
 .
   [ Mathias Gug ]
   * Sponsor to intrepid.
   * Remove .cvsignore files.
Files: 
 bf22eb7c45a15f3b54207bc7af4a6853 1415 interpreters optional libgems-ruby_1.3.0~RC1-0ubuntu1.dsc
 aadf80dbb30a451b1613ee90be5c1011 10945 interpreters optional libgems-ruby_1.3.0~RC1-0ubuntu1.diff.gz
Original-Maintainer: Daigo Moriwaki <daigo at debian.org>
-------------- next part --------------
diff -pruN 1.2.0-2/.autotest 1.3.0~RC1-0ubuntu1/.autotest
--- 1.2.0-2/.autotest	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/.autotest	2008-08-27 17:30:06.000000000 +0100
@@ -0,0 +1,18 @@
+Autotest.add_hook :initialize do |at|
+  at.order = :natural # I am a bad person - Eric Hodel
+
+  at.add_exception %r%/\.svn/%
+  at.add_exception %r%\.rbc$%
+
+  at.find_directories.clear
+  at.find_directories.push 'lib', 'test'
+
+  at.add_mapping %r%^lib/rubygems.rb$% do |_, m|
+    "test/test_gem.rb"
+  end
+
+  at.add_mapping %r%^lib/rubygems/(.*).rb$% do |_, m|
+    "test/test_gem_#{m[1].gsub '/', '_'}.rb"
+  end
+end
+
diff -pruN 1.2.0-2/ChangeLog 1.3.0~RC1-0ubuntu1/ChangeLog
--- 1.2.0-2/ChangeLog	2008-06-22 03:03:33.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/ChangeLog	2008-08-27 17:30:06.000000000 +0100
@@ -1,3 +1,122 @@
+# -*- coding: utf-8 -*-
+2008-08-22  Luis Lavena  <luislavena at gmail.com>
+
+	* lib/rubygems.rb: Corrected usage of HOMEDRIVE and HOMEPATH on Windows.
+	Escape Gem.ruby if spaces in the path are present. Solves bug related to
+	extensions compile process.
+	* test/test_gem.rb: Added test to verify both conditions.
+
+2008-08-17  Eric Hodel  <drbrain at segment7.net>
+
+	* doc/release_notes/rel_1_3_0.rdoc:  Initial release notes for 1.3.0.
+	* util/CL2notes:  Release note creation helper script.
+
+2008-08-16  Eric Hodel  <drbrain at segment7.net>
+
+	* lib/rubygems/local_remote_options.rb:  Added #both? to complement
+	  #local? and #remote?.
+	* lib/rubygems/commands/query_command.rb:  Print out LOCAL/REMOTE with
+	--both, even without a TTY.
+	* lib/rubygems.rb:  Add Gem.find_files, allows a gem to discover
+	features provided by other gems.
+
+2008-08-14  Wilson Bilkovich  <wilson at supremetyrant.com>
+
+	* lib/rubygems/source_index.rb: Deprecate options to 'search' other than
+	Gem::Dependency instances and issue warning until November 2008.
+	* lib/rubygems/platform.rb:	Remove deprecated constant warnings
+	and really deprecate them.
+	* Rakefile: If the SETUP_OPTIONS environment variable is set, pass its
+	contents as arguments to setup.rb
+	* test/test_gem_commands_uninstall_command.rb: Added
+
+2008-08-13  Wilson Bilkovich  <wilson at supremetyrant.com>
+
+	* lib/rubygems/uninstaller.rb:	Fix binary script uninstallation.
+	Bug #21234 by Neil Wilson.
+	* test/test_gem_commands_uninstall_command.rb: Added
+
+2008-08-12  Eric Hodel  <drbrain at segment7.net>
+
+	* lib/rubygems/installer.rb:  Try to create directory before diverting
+	to ~/.gems.
+	* lib/rubygems/uninstaller.rb:  Fix uninstallation with -i.  Bug
+	#20812 by John Clayton.  Have #remove_all call #uninstall_gem so hooks
+	get called.  Bug #21242 by Neil Wilson.
+	* lib/rubygems/commands/update_command.rb:  Fix updating RubyGems when
+	no previous rubygems-update is installed.  Bug #20775 by Hemant Kumar.
+
+2008-08-11  Eric Hodel  <drbrain at segment7.net>
+
+	* lib/rubygems/remote_fetcher.rb:  Fix HTTPS support.  Patch #21072 by
+	Alex Arnell.  Fix Not Modified handling.  Bug #21310 by Gordon
+	Thiesfeld.
+
+2008-07-11  Luis Lavena  <luislavena at gmail.com>
+
+	* setup.rb: Properly build --destdir folder structure using Pathname.
+	* test/mockgemui.rb: Fix warnings about instance variables in a module.
+
+2008-07-02  Phil Hagelberg <technomancy at gmail.com>
+
+	* lib/rubygems/defaults.rb: Add Gem.user_dir to use paths like
+	~/.gem/ruby/1.8/gems and the like instead of just ~/.gem. Update
+	remote fetcher and installer to use it.
+
+2008-07-01  Eric Hodel  <drbrain at segment7.net>
+
+	* lib/rubygems/installer.rb:  Add #gem_home, #bin_dir for hooks.  Use
+	DependencyInstaller's source_index so reinstallation via -i does not
+	fail.
+	* lib/rubygems/uninstaller.rb:  Add #gem_home, #bin_dir for hooks.
+	* lib/rubygems/commands/query_command.rb:  Don't print LOCAL/REMOTE
+	gems if stdout is not a TTY.
+	* lib/rubygems/commands/query_command.rb:  Use the regexp we already
+	have for `gem list --installed`.  Bug #20876 by Nick Hoffman.
+	* lib/rubygems/commands/which_command.rb:  Clarify what `gem which` is
+	for.
+
+2008-06-30  Eric Hodel  <drbrain at segment7.net>
+
+	* test/test_ext_configure_builder.rb:  Locale-free patch by Yusuke
+	Endoh [ruby-core:17444].
+	* lib/rubygems.rb:  Add pre/post (un)install hooks.
+	* lib/rubygems/installer.rb:  Call pre/post install hooks as
+	appropriate.
+	* lib/rubygems/uninstaller.rb:  Call pre/post uninstall hooks as
+	appropriate.  Minor refactoring of #uninstall.
+	* lib/rubygems/package/tar_reader.rb:  Some OSs raise EINVAL on seek.
+	Based on patch in bug #20791 by Neil Wilson.
+	* lib/rubygems/specification.rb:  Correctly check for support of
+	development dependencies for #to_ruby.  Bug #20778 by Evan Weaver.
+	* lib/rubygems/spec_fetcher.rb:  Correctly load all cache file even if
+	latest has been loaded.  Bug #20776 by Uwe Kubosch.
+
+2008-06-25  Eric Hodel  <drbrain at segment7.net>
+
+	* lib/rubygems/config_file.rb:  Add Gem::ConfigFile constants for
+	packagers and implementors to override defaults.
+	* test/*:  Fixes to run tests when under test/rubygems/.  Patch by
+	Yusuke ENDOH [ruby-core:17353].
+
+2008-06-24  Eric Hodel  <drbrain at segment7.net>
+
+	* lib/rubygems/remote_fetcher.rb:  Cleanup to support
+	if-modified-since requests.  pair: Ryan Davis
+	* lib/rubygems/indexer:  Force platform to Gem::Platform::RUBY when
+	nil or blank.  Fixes various uninstallable gems.
+
+2008-06-24  Phil Hagelberg <technomancy at gmail.com>
+
+	* lib/rubygems/installer.rb: Fall back on ~/.gem if GEM_HOME is
+	not writable.
+	* lib/rubygems/install_update_options.rb: Allow --user-install or
+	--no-user-install command-line switch to explicitly force whether
+	or not ~/.gem should be used.
+	* lib/rubygems/remote_fetcher.rb: Use ~/.gem/cache if cache dir is
+	not writable.
+	* test/gemutilities.rb: Use MockGemUi for all tests.
+
 2008-06-21  Eric Hodel  <drbrain at segment7.net>
 
 	* lib/rubygems/specification.rb:  Load specifications from the future.
diff -pruN 1.2.0-2/debian/changelog 1.3.0~RC1-0ubuntu1/debian/changelog
--- 1.2.0-2/debian/changelog	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/changelog	2008-08-27 20:17:15.000000000 +0100
@@ -1,9 +1,35 @@
-libgems-ruby (1.2.0-2) unstable; urgency=low
+libgems-ruby (1.3.0~RC1-0ubuntu1) intrepid; urgency=low
 
-  * debian/rules: Fixed a file conflict with libruby1.9 (Closes: #493309)
+  [ Neil Wilson ]
+  * Make alternatives respond to verbose option.
+  * Use a gem specific alternatives database.
+  * Add rubygems default package that points at rubygems1.8
+  * debian/patches: 40_make_update_system_run_apt_get - make
+    'update --system' call apt-get. Replaces 03_disable_update_system.
+  * Import from SVN to obtain hooks.
+  * Use defaults/operating_system.rb to enforce Debian standards.
+  * Use alternatives system to make gems available on PATH.
+    Closes LP: #145267.
+  * Move to CDBS simple patch system from dpatch.
+  * Remove tight ruby1.9 build dependency to allow backports.
+  * debian/patches: remove 21_avoid_ioseek - incorporated upstream.
+  * debian/patches: remove 01_default_gem_path - replaced by
+    debian/operating_system.rb.
+  * debian/patches: remove 08_tighter_regex_search - upstream now uses
+    a different search system that does not have the substring problem.
+
+  [ Mathias Gug ]
+  * Sponsor to intrepid.
+  * Remove .cvsignore files.
 
- -- Daigo Moriwaki <daigo at debian.org>  Sun, 03 Aug 2008 21:32:36 +0900
+ -- Mathias Gug <mathiaz at ubuntu.com>  Wed, 27 Aug 2008 12:40:08 -0400
 
+libgems-ruby (1.2.0-2) unstable; urgency=low
+ 
+  * debian/rules: Fixed a file conflict with libruby1.9 (Closes: #493309)
+ 
+ -- Daigo Moriwaki <daigo at debian.org>  Sun, 03 Aug 2008 21:32:36 +0900
+ 
 libgems-ruby (1.2.0-1) unstable; urgency=low
 
   * New upstream release. (Closes: #487820)
diff -pruN 1.2.0-2/debian/control 1.3.0~RC1-0ubuntu1/debian/control
--- 1.2.0-2/debian/control	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/control	2008-08-27 20:17:15.000000000 +0100
@@ -1,18 +1,36 @@
 Source: libgems-ruby
 Section: interpreters
 Priority: optional
-Maintainer: Daigo Moriwaki <daigo at debian.org>
+Maintainer: Ubuntu MOTU Developers <ubuntu-motu at lists.ubuntu.com>
+XSBC-Original-Maintainer: Daigo Moriwaki <daigo at debian.org>
 Uploaders: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
-Build-Depends: cdbs, dpatch (>= 2.0.10), debhelper (>= 4.0.0), ruby1.8, rdoc1.8, ruby1.9 (>= 1.9.0.1-5), rdoc1.9, ruby-pkg-tools
+Build-Depends: cdbs, debhelper (>= 4.0.0), ruby1.8, rdoc, ruby1.9
 Standards-Version: 3.7.3
 Homepage: http://rubygems.org/
+XS-Vcs-git: git://github.com/NeilW/deb-rubygems.git
+XS-Vcs-browser: http://github.com/NeilW/deb-rubygems/tree/master
+
+Package: rubygems
+Architecture: all
+Depends: rubygems1.8, ruby
+Description: package management framework for Ruby libraries/applications
+ This is a way to package Ruby libraries/applications for distribution.
+ RubyGems provides the ability to manage concurrent versions of libraries and
+ dependencies between those libraries. Using RubyGems, you can:
+   * download and install Ruby libraries easily
+   * not worry about libraries A and B depending on different versions of
+     library C
+   * easily remove libraries you no longer use
+ .
+ This package is a dependency package, which depends upon the Debian default
+ Ruby version (currently 1.8.x).
 
 Package: rubygems1.8
 Architecture: all
 Depends: ruby1.8, rdoc1.8
 Suggests: ruby1.8-dev, build-essential, rubygems-doc
-Conflicts: libgems-ruby1.8, rubygems
-Replaces: libgems-ruby1.8, rubygems
+Conflicts: libgems-ruby1.8, rubygems (< 1.2)
+Replaces: libgems-ruby1.8, rubygems (< 1.2)
 Description: package management framework for Ruby libraries/applications
  This is a way to package Ruby libraries/applications for distribution.
  RubyGems provides the ability to manage concurrent versions of libraries and
diff -pruN 1.2.0-2/debian/copyright 1.3.0~RC1-0ubuntu1/debian/copyright
--- 1.2.0-2/debian/copyright	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/copyright	2008-08-27 20:17:15.000000000 +0100
@@ -67,11 +67,17 @@ You can redistribute it and/or modify it
      WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
      PURPOSE.
 
--- 
-On Debian GNU/Linux systems, the complete text of the GNU General
-Public License can be found in `/usr/share/common-licenses/GPL'.
+* debian/etc/bash-completion.d
+    Rubygems bash completion
+    Copyright (c) Michael Schuerig, <michael at schuerig.de> 2007-02-24.
+    Free for all uses.
 
+* debian/operating_system.rb
+    RubyGems - Debian packaging alterations
+    Copyright (C) 2008, Neil Wilson, Brightbox Systems <neil at brightbox.co.uk>
+    Licensed under GPL-2 (see /usr/share/common-licenses/GPL-2)
+
+Packaging:
+    Copyright (C) 2004-2008, Daigo Moriwaki <daigo at debian.org>.
+    Licensed under GPL-2 (see /usr/share/common-licenses/GPL-2)
 
-debian/patches/22_add_bash_completion.dpatch
-Rubygems bash completion (c) Michael Schuerig, michael at schuerig.de, 2007-02-24
-Free for all uses.
diff -pruN 1.2.0-2/debian/operating_system.rb 1.3.0~RC1-0ubuntu1/debian/operating_system.rb
--- 1.2.0-2/debian/operating_system.rb	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/operating_system.rb	2008-08-27 20:17:15.000000000 +0100
@@ -0,0 +1,100 @@
+#    RubyGems - Debian packaging alterations
+#    Copyright (C) 2008, Neil Wilson, Brightbox Systems
+#    
+#    This file is part of Rubygems packaging
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details
+#    (/usr/share/common-licenses/GPL-2).
+#
+require "rubygems/config_file"
+
+module Gem
+
+  # Set the default gem installation directories and paths to the Debian
+  # defaults by poking the correct values into the ENV hash.
+  ENV['GEM_HOME'] = File.join('','var','lib','gems',ConfigMap[:ruby_version])
+  # I don't want to see 'default_dir' ever.
+  ENV['GEM_PATH'] = user_dir
+
+  # Always remove the executable when the gem is removed.
+  # (No good reason for them to remain and they complicate the 
+  # alternatives system)
+  ConfigFile::OPERATING_SYSTEM_DEFAULTS["uninstall"] = "-x"
+  # Don't create documentation unless asked
+  ConfigFile::OPERATING_SYSTEM_DEFAULTS["install"] = "--no-ri --no-rdoc"
+  ConfigFile::OPERATING_SYSTEM_DEFAULTS["update"] = "--no-ri --no-rdoc"
+
+  # Alternatives directories
+  def self.altdir
+    File.join('','usr','local','etc','gems','alternatives')
+  end
+
+  def self.admindir
+    File.join(Gem.dir,'..','alternatives')
+  end
+
+  def self.localbindir
+    File.join('','usr','local','bin')
+  end
+
+  # Alternatives command
+  def self.update_alts
+    "update-alternatives --altdir #{Gem.altdir} --admindir #{Gem.admindir} #{if Gem.configuration.really_verbose then '--verbose' else '--quiet' end}"
+  end
+
+  post_install do |installer|
+    executable_list = installer.spec.executables
+    bindir = installer.bin_dir || Gem.bindir(installer.gem_home)
+    if bindir == Gem.bindir && !executable_list.empty?
+      set_args = "#{executable_list.first} #{File.join(bindir, executable_list.first)}"
+      execs = executable_list.collect do |filename|
+        "#{File.join(Gem.localbindir,filename)} #{filename} #{File.join(bindir, filename)} " 
+      end
+      FileUtils.mkdir_p Gem.altdir unless File.directory?(Gem.altdir)
+      system %Q{
+        #{Gem.update_alts} --install #{execs.shift} 100 #{"--slave" unless execs.empty?} #{execs.join(" --slave ")} && #{update_alts} --set #{set_args}
+      }
+    end
+  end
+
+  post_uninstall do |uninstaller|
+    executable_list = uninstaller.spec.executables
+    bindir = uninstaller.bin_dir || Gem.bindir(uninstaller.gem_home)
+    if bindir == Gem.bindir && !executable_list.empty?
+      alt_group_name = executable_list.first
+      target = File.join(bindir,alt_group_name)
+      unless File.exists?(target)
+        remove_args = "#{alt_group_name} #{target}"
+        # system pipe explanation
+        # - Check there is something that needs changing
+        # - 'target' has to be there or alternatives gets upset.
+        #   (Can't move this to pre_uninstall because we don't know
+        #   if the executable needs removing there.)
+        # - if there is only 1 alternative switch to auto mode to work
+        #   around a bug in the alternatives system remove command.
+        #   (LP: 254382)
+        # - Remove the alternative
+        # - Remove the temporary target
+        system %Q{
+          #{Gem.update_alts} --list #{alt_group_name} >/dev/null &&
+          touch #{target} &&
+          if [ $(#{Gem.update_alts} --list #{alt_group_name}|wc -l) -eq 1 ]
+          then
+            #{Gem.update_alts} --auto #{alt_group_name}
+          fi &&
+          #{Gem.update_alts} --remove #{remove_args} &&
+          rm -f #{target}
+        }
+      end
+    end
+  end
+
+end
diff -pruN 1.2.0-2/debian/patches/00list 1.3.0~RC1-0ubuntu1/debian/patches/00list
--- 1.2.0-2/debian/patches/00list	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/patches/00list	1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-01_default_gem_path.dpatch
-03_disable_update_system.dpatch
-08_tighter_search_regex.dpatch
-21_avoid_ioseek.dpatch
-#05_gem_commands.dpatch
-#09_installer.dpatch 
diff -pruN 1.2.0-2/debian/patches/01_default_gem_path.dpatch 1.3.0~RC1-0ubuntu1/debian/patches/01_default_gem_path.dpatch
--- 1.2.0-2/debian/patches/01_default_gem_path.dpatch	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/patches/01_default_gem_path.dpatch	1970-01-01 01:00:00.000000000 +0100
@@ -1,50 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 01_default_gem_path.dpatch by James Healy <jimmy at deefa.com>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Changes the default gem dir from inside the ruby lib to /var/lib/gems/{ruby version}
-
- at DPATCH@
-diff -urNad trunk~/lib/rubygems/defaults.rb trunk/lib/rubygems/defaults.rb
---- trunk~/lib/rubygems/defaults.rb	2008-03-09 12:42:07.000000000 +0900
-+++ trunk/lib/rubygems/defaults.rb	2008-05-10 16:07:33.000000000 +0900
-@@ -7,16 +7,14 @@
- 
-   # Default home directory path to be used if an alternate value is not
-   # specified in the environment.
-+  # 
-+  # Debian patch: search order of this directory.
-+  #   1. GEM_HOME enviroment variable
-+  #      (Using this, Gems are to be installed in any path as you like)
-+  #   2. /var/lib/gems/{ruby version} (This is the default path in Debian system)
-+  #
-   def self.default_dir
--    if defined? RUBY_FRAMEWORK_VERSION then
--      File.join File.dirname(ConfigMap[:sitedir]), 'Gems',
--                ConfigMap[:ruby_version]
--    elsif defined? RUBY_ENGINE then
--      File.join ConfigMap[:libdir], RUBY_ENGINE, 'gems',
--                ConfigMap[:ruby_version]
--    else
--      File.join ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version]
--    end
-+    File.join('/', 'var', 'lib', 'gems', ConfigMap[:ruby_version])
-   end
- 
-   # Default gem path.
-@@ -31,12 +29,10 @@
-   end
- 
-   # The default directory for binaries
-+  # Debian patch: 
-+  #   /var/lib/gems/{ruby version}/bin is the default path in Debian system
-   def self.default_bindir
--    if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
--      '/usr/bin'
--    else # generic install
--      ConfigMap[:bindir]
--    end
-+    File.join('/', 'var', 'lib', 'gems', ConfigMap[:ruby_version], 'bin')
-   end
- 
-   # The default system-wide source info cache directory.
diff -pruN 1.2.0-2/debian/patches/03_disable_update_system.dpatch 1.3.0~RC1-0ubuntu1/debian/patches/03_disable_update_system.dpatch
--- 1.2.0-2/debian/patches/03_disable_update_system.dpatch	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/patches/03_disable_update_system.dpatch	1970-01-01 01:00:00.000000000 +0100
@@ -1,25 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 03_disable_update_system.dpatch by James Healy <jimmy at deefa.com>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Disable gem update --system functionality, as it can break things. Users should use apt instead
-
- at DPATCH@
-diff -urNad trunk~/lib/rubygems/commands/update_command.rb trunk/lib/rubygems/commands/update_command.rb
---- trunk~/lib/rubygems/commands/update_command.rb	2008-04-08 06:32:28.000000000 +0900
-+++ trunk/lib/rubygems/commands/update_command.rb	2008-05-10 15:38:29.000000000 +0900
-@@ -47,13 +47,7 @@
- 
-   def execute
-     if options[:system] then
--      say "Updating RubyGems"
--
--      unless options[:args].empty? then
--        fail "No gem names are allowed with the --system option"
--      end
--
--      options[:args] = ["rubygems-update"]
-+      fail "gem update --system is disabled on Debian. RubyGems can be updated using the official Debian repositories by aptitude or apt-get."
-     else
-       say "Updating installed gems"
-     end
diff -pruN 1.2.0-2/debian/patches/05_gem_commands.dpatch 1.3.0~RC1-0ubuntu1/debian/patches/05_gem_commands.dpatch
--- 1.2.0-2/debian/patches/05_gem_commands.dpatch	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/patches/05_gem_commands.dpatch	1970-01-01 01:00:00.000000000 +0100
@@ -1,28 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 05_gem_commands.dpatch by  <daigo at debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: New patch generated from libgems-ruby 0.8.10-1 diff.gz
-
- at DPATCH@
-
---- libgems-ruby-0.9.0.orig/lib/rubygems/gem_commands.rb
-+++ libgems-ruby-0.9.0/lib/rubygems/gem_commands.rb
-@@ -1,4 +1,3 @@
--#!/usr/bin/env ruby
- #--
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
- # All rights reserved.
-@@ -97,6 +96,12 @@
-         options[:install_dir] = File.expand_path(value)
-       end
- 
-+      add_option('-B', '--build-root DIR', 
-+  'Temporary installation root. Useful for building packages.') do
-+  |value, options|
-+        options[:build_root] = File.expand_path(value)
-+      end
-+
-       add_option('-d', '--[no-]rdoc', 
- 	'Generate RDoc documentation for the gem on install') do
- 	|value, options|
diff -pruN 1.2.0-2/debian/patches/08_tighter_search_regex.dpatch 1.3.0~RC1-0ubuntu1/debian/patches/08_tighter_search_regex.dpatch
--- 1.2.0-2/debian/patches/08_tighter_search_regex.dpatch	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/patches/08_tighter_search_regex.dpatch	1970-01-01 01:00:00.000000000 +0100
@@ -1,19 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 08_tighter_search_regex.dpatch by Daigo Moriwaki <daigo at debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Included at 0.8.11-2
-
- at DPATCH@
-diff -urNad trunk~/lib/rubygems/source_index.rb trunk/lib/rubygems/source_index.rb
---- trunk~/lib/rubygems/source_index.rb	2008-04-05 08:06:49.000000000 +0900
-+++ trunk/lib/rubygems/source_index.rb	2008-05-10 15:40:39.000000000 +0900
-@@ -248,7 +248,7 @@
-                     end
-     else
-       version_requirement = platform_only || Gem::Requirement.default
--      gem_pattern = /#{gem_pattern}/i
-+      gem_pattern = /^#{gem_pattern}/i
-     end
- 
-     unless Gem::Requirement === version_requirement then
diff -pruN 1.2.0-2/debian/patches/09_installer.dpatch 1.3.0~RC1-0ubuntu1/debian/patches/09_installer.dpatch
--- 1.2.0-2/debian/patches/09_installer.dpatch	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/patches/09_installer.dpatch	1970-01-01 01:00:00.000000000 +0100
@@ -1,60 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 09_installer.dpatch by Daigo Moriwaki <daigo at debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: No description.
-
- at DPATCH@
-diff -urNad trunk~/lib/rubygems/installer.rb trunk/lib/rubygems/installer.rb
---- trunk~/lib/rubygems/installer.rb	2007-05-11 04:01:45.000000000 +0900
-+++ trunk/lib/rubygems/installer.rb	2007-05-27 08:51:33.000000000 +0900
-@@ -84,6 +84,14 @@
-         end
-       end
- 
-+      if @options[:build_root]
-+        build_root = @options[:build_root]
-+        FileUtils.mkdir_p build_root
-+        raise Gem::FilePermissionError.new(build_root) unless File.writable?(build_root)
-+        install_dir = build_root + install_dir
-+        FileUtils.mkdir_p install_dir
-+      end
-+
-       raise Gem::FilePermissionError.new(Pathname.new(install_dir).expand_path) unless File.writable?(install_dir)
- 
-       # Build spec dir.
-@@ -393,6 +401,7 @@
-     #
-     def initialize(gem, options)
-       @gem = gem
-+      @options = options
-       @version = options[:version] || "> 0"
-       @force_executables = options[:executables]
-       @force_all = options[:all]
-@@ -447,8 +456,13 @@
-     def remove_executables(gemspec)
-       return if gemspec.nil?
-       if(gemspec.executables.size > 0)
--        raise Gem::FilePermissionError.new(Gem.bindir) unless
--          File.writable?(Gem.bindir)
-+        bindir = Gem.bindir
-+        if @options[:build_root]
-+          install_dir = File.join(@options[:build_root], Gem.dir)
-+          bindir = Gem.bindir(install_dir)
-+        end
-+        raise Gem::FilePermissionError.new(bindir) unless
-+          File.writable?(bindir)
-         list = Gem.source_index.search(gemspec.name).delete_if { |spec|
-           spec.version == gemspec.version
-         }
-@@ -469,8 +483,8 @@
-         else
-           gemspec.executables.each do |exe_name|
-             say "Removing #{exe_name}"
--            File.unlink File.join(Gem.bindir, exe_name) rescue nil
--            File.unlink File.join(Gem.bindir, exe_name + ".cmd") rescue nil
-+            File.unlink File.join(bindir, exe_name) rescue nil
-+            File.unlink File.join(bindir, exe_name + ".cmd") rescue nil
-           end
-         end
-       end
diff -pruN 1.2.0-2/debian/patches/21_avoid_ioseek.dpatch 1.3.0~RC1-0ubuntu1/debian/patches/21_avoid_ioseek.dpatch
--- 1.2.0-2/debian/patches/21_avoid_ioseek.dpatch	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/patches/21_avoid_ioseek.dpatch	1970-01-01 01:00:00.000000000 +0100
@@ -1,34 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 21_avoid_ioseek.dpatch by Daigo Moriwaki <daigo at debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: A work around for Bug#406388.
-
- at DPATCH@
-diff -urNad trunk~/lib/rubygems/package/tar_reader.rb trunk/lib/rubygems/package/tar_reader.rb
---- trunk~/lib/rubygems/package/tar_reader.rb	2008-02-29 17:55:01.000000000 +0900
-+++ trunk/lib/rubygems/package/tar_reader.rb	2008-05-10 15:44:05.000000000 +0900
-@@ -47,10 +47,10 @@
- 
-       skip = (512 - (size % 512)) % 512
- 
--      if @io.respond_to? :seek then
--        # avoid reading...
--        @io.seek(size - entry.bytes_read, IO::SEEK_CUR)
--      else
-+      #if @io.respond_to? :seek then
-+      #  # avoid reading...
-+      #  @io.seek(size - entry.bytes_read, IO::SEEK_CUR)
-+      #else
-         pending = size - entry.bytes_read
- 
-         while pending > 0 do
-@@ -58,7 +58,7 @@
-           raise UnexpectedEOF if @io.eof?
-           pending -= bread
-         end
--      end
-+      #end
- 
-       @io.read skip # discard trailing zeros
- 
diff -pruN 1.2.0-2/debian/patches/40_make_update_system_run_apt_get.patch 1.3.0~RC1-0ubuntu1/debian/patches/40_make_update_system_run_apt_get.patch
--- 1.2.0-2/debian/patches/40_make_update_system_run_apt_get.patch	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/patches/40_make_update_system_run_apt_get.patch	2008-08-27 20:17:15.000000000 +0100
@@ -0,0 +1,29 @@
+diff -Nur -x '*.orig' -x '*~' libgems-ruby/lib/rubygems/commands/update_command.rb libgems-ruby.new/lib/rubygems/commands/update_command.rb
+--- libgems-ruby/lib/rubygems/commands/update_command.rb	2008-08-13 18:49:11.000000000 +0100
++++ libgems-ruby.new/lib/rubygems/commands/update_command.rb	2008-08-13 18:58:03.000000000 +0100
+@@ -44,6 +44,16 @@
+     "#{program_name} GEMNAME [GEMNAME ...]"
+   end
+ 
++  def update_rubygems_command
++    "apt-get install rubygems" <<
++    case RUBY_VERSION
++    when /1\.9/
++      "1.9"
++    when /1\.8/
++      "1.8"
++    end
++  end
++
+   def execute
+     hig = {}
+ 
+@@ -54,6 +64,8 @@
+         fail "No gem names are allowed with the --system option"
+       end
+ 
++      exec update_rubygems_command
++
+       spec = Gem::Specification.new
+       spec.name = 'rubygems-update'
+       spec.version = Gem::Version.new Gem::RubyGemsVersion
diff -pruN 1.2.0-2/debian/README.Debian 1.3.0~RC1-0ubuntu1/debian/README.Debian
--- 1.2.0-2/debian/README.Debian	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/README.Debian	2008-08-27 20:17:15.000000000 +0100
@@ -11,10 +11,7 @@ override it by defining GEM_HOME environ
 
 * Executables provided by gems
 
-Gems which Debian's RubyGems will install are stored at /var/lib/gems instead
-of /usr/lib/ruby/gems. Executables of the gems will be put at
-/var/lib/gems/{1.8|1.9.0}/bin. In order to use them you manually have to
-add the directory in your PATH environment variable or make symbolic links at
-/usr/bin or /usr/local/bin.
+Executables of the gems will be put at /var/lib/gems/{1.8|1.9.0}/bin,
+and symlinked into /usr/local/bin using the alternatives system
 
- -- Daigo Moriwaki <daigo at debian.org>  Mon, 09 Jun 2008
+ -- Neil Wilson <neil at brightbox.co.uk>  Wed, 16 Jul 2008
diff -pruN 1.2.0-2/debian/rules 1.3.0~RC1-0ubuntu1/debian/rules
--- 1.2.0-2/debian/rules	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/rules	2008-08-27 20:17:15.000000000 +0100
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 
 include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/rules/dpatch.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk
 
 DEB_INSTALL_CHANGELOGS_ALL = ChangeLog debian/README.Debian
 
@@ -13,8 +13,8 @@ RUBY19LIBDIR = $(shell $(RUBY19) -rrbcon
 
 DEB_INSTALL_DOCS_rubygems-doc += html
 
-DEB_INSTALL_DIRS_rubygems1.8 += usr/bin/ usr/lib/ruby/1.8/  var/lib/gems/1.8/
-DEB_INSTALL_DIRS_rubygems1.9 += usr/bin/ usr/lib/ruby/1.9.0 var/lib/gems/1.9.0/
+DEB_INSTALL_DIRS_rubygems1.8 += usr/bin/ usr/lib/ruby/1.8/  var/lib/gems/1.8/ /var/lib/gems/alternatives
+DEB_INSTALL_DIRS_rubygems1.9 += usr/bin/ usr/lib/ruby/1.9.0 var/lib/gems/1.9.0/ /var/lib/gems/alternatives
 
 DEB_INSTALL_MANPAGES_rubygems1.8 += debian/gem1.8.1
 DEB_INSTALL_MANPAGES_rubygems1.9 += debian/gem1.9.1
@@ -52,6 +52,8 @@ install/rubygems1.8::
 	rm -rf $(CURDIR)/debian/$(cdbs_curpkg)/bin/
 	dh_install -p$(cdbs_curpkg)\
 	  debian/etc/bash_completion.d/gem1.8 etc/bash_completion.d/
+	dh_install -p$(cdbs_curpkg)\
+	  debian/operating_system.rb $(RUBY18LIBDIR)/rubygems/defaults/
 
 install/rubygems1.9::
 	find $(CURDIR)/debian/ -type f -name "*.in" | \
@@ -72,4 +74,6 @@ install/rubygems1.9::
 	rm -rf $(CURDIR)/debian/$(cdbs_curpkg)/bin/
 	dh_install -p$(cdbs_curpkg) \
 	  debian/etc/bash_completion.d/gem1.9 etc/bash_completion.d/
+	dh_install -p$(cdbs_curpkg) \
+	  debian/operating_system.rb $(RUBY19LIBDIR)/rubygems/defaults/
 
diff -pruN 1.2.0-2/debian/watch 1.3.0~RC1-0ubuntu1/debian/watch
--- 1.2.0-2/debian/watch	2008-08-27 20:19:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/debian/watch	2008-08-27 20:17:15.000000000 +0100
@@ -3,4 +3,4 @@
 # to check for upstream updates and more.
 # Site		Directory		Pattern			Version	Script
 version=3
-http://rubyforge.org/frs/?group_id=126	.*/rubygems-(.*).tgz	debian	uupdate	
+http://rubyforge.org/frs/?group_id=126	.*/rubygems-(.*).tgz	debian	git-import-orig
diff -pruN 1.2.0-2/doc/release_notes/rel_1_3_0.rdoc 1.3.0~RC1-0ubuntu1/doc/release_notes/rel_1_3_0.rdoc
--- 1.2.0-2/doc/release_notes/rel_1_3_0.rdoc	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/doc/release_notes/rel_1_3_0.rdoc	2008-08-27 17:30:06.000000000 +0100
@@ -0,0 +1,110 @@
+= Announce: RubyGems Release 1.3.0
+
+Release 1.3.0 adds new features and fixes some bugs.
+
+New features:
+
+* RubyGems doesn't print LOCAL/REMOTE titles for `gem query` and friends if
+  stdout is not a TTY, except with --both.
+* Added Gem.find_files, allows a gem to discover features provided by other
+  gems.
+* Added pre/post (un)install hooks for packagers of RubyGems.  (Not for gems
+  themselves).
+* RubyGems now installs into ~/.gem if GEM_HOME is not writable.  Use
+  --no-user-install command-line switch to disable this behavior.
+* Fetching specs for update now uses If-Modified-Since requests.
+
+Bugs Fixed:
+
+* RubyGems 1.3.0+ now updates when no previous rubygems-update is installed.
+  Bug #20775 by Hemant Kumar.
+* RubyGems now uses the regexp we already have for `gem list --installed`.  Bug
+  #20876 by Nick Hoffman.
+* Platform is now forced to Gem::Platform::RUBY when nil or blank in the
+  indexer.  Fixes various uninstallable gems.
+* Handle EINVAL on seek.  Based on patch in bug #20791 by Neil Wilson.
+* Fix HTTPS support.  Patch #21072 by Alex Arnell.
+* RubyGems now loads all cache files even if latest has been loaded.  Bug
+  #20776 by Uwe Kubosch.
+* RubyGems checks for support of development dependencies for #to_ruby.  Bug
+  #20778 by Evan Weaver.
+* Now specifications from the future can be loaded.
+* Binary script uninstallation fixed.  Bug #21234 by Neil Wilson.
+* Uninstallation with -i fixed.  Bug #20812 by John Clayton.
+* Gem::Uninstaller#remove_all now calls Gem::Uninstaller#uninstall_gem so hooks
+  get called.  Bug #21242 by Neil Wilson.
+
+Other Changes Include:
+
+* Rakefile
+  * If the SETUP_OPTIONS environment variable is set, pass its contents as
+    arguments to setup.rb
+* lib/rubygems/platform.rb
+  * Remove deprecated constant warnings and really deprecate them.  (WIN32,
+    etc).
+* lib/rubygems/remote_fetcher.rb
+  * Now uses ~/.gem/cache if the cache dir in GEM_HOME is not writable.
+* lib/rubygems/source_index.rb
+  * Deprecate options to 'search' other than Gem::Dependency instances and
+    issue warning until November 2008.
+* setup.rb
+  * --destdir folder structure now built using Pathname, so it works for
+    Windows platforms.
+* test/*
+  * Fixes to run tests when under test/rubygems/.  Patch by Yusuke ENDOH
+    [ruby-core:17353].
+* test/test_ext_configure_builder.rb
+  * Locale-free patch by Yusuke Endoh [ruby-core:17444].
+
+For a full list of changes to RubyGems and the contributor for each change, see
+the ChangeLog file.
+
+Special thanks to Chad Wooley for backwards compatibility testing and Luis
+Lavena for continuing windows support.
+
+== How can I get RubyGems?
+
+NOTE:  If you have installed RubyGems using a package system you may want to
+install a new RubyGems through the same packaging system.
+
+If you have a recent version of RubyGems (0.8.5 or later), then all
+you need to do is:
+
+  $ gem update --system   (you might need to be admin/root)
+
+NOTE:  RubyGems 1.1 and 1.2 have problems upgrading when there is no
+rubygems-update installed.  You will need to follow the second set of update
+instructions if you see "Nothing to update".
+
+NOTE: You may have to run the command twice if you have any previosly
+installed rubygems-update gems.
+
+If you have an older version of RubyGems installed, then you can still
+do it in two steps:
+
+  $ gem install rubygems-update  (again, might need to be admin/root)
+  $ update_rubygems              (... here too)
+
+If you don't have any gems install, there is still the pre-gem
+approach to getting software ... doing it manually:
+
+1. DOWNLOAD FROM: http://rubyforge.org/frs/?group_id=126
+2. UNPACK INTO A DIRECTORY AND CD THERE
+3. INSTALL WITH:  ruby setup.rb  (you may need admin/root privilege)
+
+== To File Bugs
+
+The RubyGems bug tracker can be found on RubyForge at:
+http://rubyforge.org/tracker/?func=add&group_id=126&atid=575
+
+When filing a bug, `gem env` output will be helpful in diagnosing the issue.
+
+If you find a bug where RubyGems crashes, please provide debug output. You can
+do that with `gem --debug the_command`.
+
+== Thanks
+
+Keep those gems coming!
+
+-- Jim & Chad & Eric (for the RubyGems team)
+
diff -pruN 1.2.0-2/lib/rubygems/commands/contents_command.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/contents_command.rb
--- 1.2.0-2/lib/rubygems/commands/contents_command.rb	2007-09-24 01:43:02.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/contents_command.rb	2008-08-27 17:30:06.000000000 +0100
@@ -51,7 +51,7 @@ class Gem::Commands::ContentsCommand < G
 
     si = Gem::SourceIndex.from_gems_in(*s)
 
-    gem_spec = si.search(/\A#{gem}\z/, version).last
+    gem_spec = si.find_name(gem, version).last
 
     unless gem_spec then
       say "Unable to find gem '#{gem}' in #{path_kind}"
diff -pruN 1.2.0-2/lib/rubygems/commands/help_command.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/help_command.rb
--- 1.2.0-2/lib/rubygems/commands/help_command.rb	2008-06-17 09:19:22.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/help_command.rb	2008-08-27 17:30:06.000000000 +0100
@@ -20,9 +20,9 @@ Some examples of 'gem' usage.
     gem install --remote rake --test --rdoc --ri
 
 * Install 'rake', but only version 0.3.1, even if dependencies
-  are not met, and into a specific directory:
+  are not met, and into a user-specific directory:
 
-    gem install rake --version 0.3.1 --force --install-dir $HOME/.gems
+    gem install rake --version 0.3.1 --force --user-install
 
 * List local gems whose name begins with 'D':
 
diff -pruN 1.2.0-2/lib/rubygems/commands/outdated_command.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/outdated_command.rb
--- 1.2.0-2/lib/rubygems/commands/outdated_command.rb	2008-06-04 22:53:41.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/outdated_command.rb	2008-08-27 17:30:06.000000000 +0100
@@ -19,7 +19,7 @@ class Gem::Commands::OutdatedCommand < G
     locals = Gem::SourceIndex.from_installed_gems
 
     locals.outdated.sort.each do |name|
-      local = locals.search(/^#{name}$/).last
+      local = locals.find_name(name).last
 
       dep = Gem::Dependency.new local.name, ">= #{local.version}"
       remotes = Gem::SpecFetcher.fetcher.fetch dep
diff -pruN 1.2.0-2/lib/rubygems/commands/pristine_command.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/pristine_command.rb
--- 1.2.0-2/lib/rubygems/commands/pristine_command.rb	2008-06-07 01:07:17.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/pristine_command.rb	2008-08-27 17:30:06.000000000 +0100
@@ -57,7 +57,7 @@ revert the gem.
               end
             else
               gem_name = get_one_gem_name
-              Gem::SourceIndex.from_installed_gems.search(gem_name,
+              Gem::SourceIndex.from_installed_gems.find_name(gem_name,
                                                           options[:version])
             end
 
diff -pruN 1.2.0-2/lib/rubygems/commands/query_command.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/query_command.rb
--- 1.2.0-2/lib/rubygems/commands/query_command.rb	2008-06-21 21:46:49.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/query_command.rb	2008-08-27 17:30:06.000000000 +0100
@@ -59,7 +59,7 @@ class Gem::Commands::QueryCommand < Gem:
       if name.source.empty? then
         alert_error "You must specify a gem name"
         exit_code |= 4
-      elsif installed? name.source, options[:version] then
+      elsif installed? name, options[:version] then
         say "true"
       else
         say "false"
@@ -69,12 +69,16 @@ class Gem::Commands::QueryCommand < Gem:
       raise Gem::SystemExitException, exit_code
     end
 
+    dep = Gem::Dependency.new name, Gem::Requirement.default
+
     if local? then
-      say
-      say "*** LOCAL GEMS ***"
-      say
+      if ui.outs.tty? or both? then
+        say
+        say "*** LOCAL GEMS ***"
+        say
+      end
 
-      specs = Gem.source_index.search name
+      specs = Gem.source_index.search dep
 
       spec_tuples = specs.map do |spec|
         [[spec.name, spec.version, spec.original_platform, spec], :local]
@@ -84,13 +88,14 @@ class Gem::Commands::QueryCommand < Gem:
     end
 
     if remote? then
-      say
-      say "*** REMOTE GEMS ***"
-      say
+      if ui.outs.tty? or both? then
+        say
+        say "*** REMOTE GEMS ***"
+        say
+      end
 
       all = options[:all]
 
-      dep = Gem::Dependency.new name, Gem::Requirement.default
       begin
         fetcher = Gem::SpecFetcher.fetcher
         spec_tuples = fetcher.find_matching dep, all, false
diff -pruN 1.2.0-2/lib/rubygems/commands/specification_command.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/specification_command.rb
--- 1.2.0-2/lib/rubygems/commands/specification_command.rb	2008-05-23 21:49:20.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/specification_command.rb	2008-08-27 17:30:06.000000000 +0100
@@ -40,6 +40,7 @@ class Gem::Commands::SpecificationComman
   def execute
     specs = []
     gem = get_one_gem_name
+    dep = Gem::Dependency.new gem, options[:version]
 
     if local? then
       if File.exist? gem then
@@ -47,12 +48,11 @@ class Gem::Commands::SpecificationComman
       end
 
       if specs.empty? then
-        specs.push(*Gem.source_index.search(/\A#{gem}\z/, options[:version]))
+        specs.push(*Gem.source_index.search(dep))
       end
     end
 
     if remote? then
-      dep = Gem::Dependency.new gem, options[:version]
       found = Gem::SpecFetcher.fetcher.fetch dep
 
       specs.push(*found.map { |spec,| spec })
diff -pruN 1.2.0-2/lib/rubygems/commands/unpack_command.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/unpack_command.rb
--- 1.2.0-2/lib/rubygems/commands/unpack_command.rb	2008-02-24 03:32:12.000000000 +0000
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/unpack_command.rb	2008-08-27 17:30:06.000000000 +0100
@@ -68,7 +68,7 @@ class Gem::Commands::UnpackCommand < Gem
   def get_path(gemname, version_req)
     return gemname if gemname =~ /\.gem$/i
 
-    specs = Gem::source_index.search(/\A#{gemname}\z/, version_req)
+    specs = Gem::source_index.find_name gemname, version_req
 
     selected = specs.sort_by { |s| s.version }.last
 
diff -pruN 1.2.0-2/lib/rubygems/commands/update_command.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/update_command.rb
--- 1.2.0-2/lib/rubygems/commands/update_command.rb	2008-06-09 23:49:12.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/update_command.rb	2008-08-27 17:30:06.000000000 +0100
@@ -45,6 +45,8 @@ class Gem::Commands::UpdateCommand < Gem
   end
 
   def execute
+    hig = {}
+
     if options[:system] then
       say "Updating RubyGems"
 
@@ -52,16 +54,22 @@ class Gem::Commands::UpdateCommand < Gem
         fail "No gem names are allowed with the --system option"
       end
 
-      options[:args] = ["rubygems-update"]
+      spec = Gem::Specification.new
+      spec.name = 'rubygems-update'
+      spec.version = Gem::Version.new Gem::RubyGemsVersion
+      spec.version = Gem::Version.new '1.1.1'
+      hig['rubygems-update'] = spec
+
+      options[:user_install] = false
     else
       say "Updating installed gems"
-    end
 
-    hig = {} # highest installed gems
+      hig = {} # highest installed gems
 
-    Gem.source_index.each do |name, spec|
-      if hig[spec.name].nil? or hig[spec.name].version < spec.version then
-        hig[spec.name] = spec
+      Gem.source_index.each do |name, spec|
+        if hig[spec.name].nil? or hig[spec.name].version < spec.version then
+          hig[spec.name] = spec
+        end
       end
     end
 
@@ -84,14 +92,14 @@ class Gem::Commands::UpdateCommand < Gem
     end
 
     if gems_to_update.include? "rubygems-update" then
-      latest_ruby_gem = remote_gemspecs.select do |s|
-        s.name == 'rubygems-update'
-      end
+      Gem.source_index.refresh!
+
+      update_gems = Gem.source_index.search 'rubygems-update'
 
-      latest_ruby_gem = latest_ruby_gem.sort_by { |s| s.version }.last
+      latest_update_gem = update_gems.sort_by { |s| s.version }.last
 
-      say "Updating version of RubyGems to #{latest_ruby_gem.version}"
-      installed = do_rubygems_update latest_ruby_gem.version
+      say "Updating RubyGems to #{latest_update_gem.version}"
+      installed = do_rubygems_update latest_update_gem.version
 
       say "RubyGems system software updated" if installed
     else
diff -pruN 1.2.0-2/lib/rubygems/commands/which_command.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/which_command.rb
--- 1.2.0-2/lib/rubygems/commands/which_command.rb	2007-09-22 23:54:41.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/commands/which_command.rb	2008-08-27 17:30:06.000000000 +0100
@@ -3,10 +3,10 @@ require 'rubygems/gem_path_searcher'
 
 class Gem::Commands::WhichCommand < Gem::Command
 
-  EXT = %w[.rb .rbw .so .dll] # HACK
+  EXT = %w[.rb .rbw .so .dll .bundle] # HACK
 
   def initialize
-    super 'which', 'Find the location of a library',
+    super 'which', 'Find the location of a library file you can require',
           :search_gems_first => false, :show_all => false
 
     add_option '-a', '--[no-]all', 'show all matching files' do |show_all, options|
@@ -52,7 +52,7 @@ class Gem::Commands::WhichCommand < Gem:
       paths = find_paths arg, dirs
 
       if paths.empty? then
-        say "Can't find #{arg}"
+        say "Can't find ruby library file or shared library #{arg}"
       else
         say paths
       end
@@ -84,3 +84,4 @@ class Gem::Commands::WhichCommand < Gem:
   end
 
 end
+
diff -pruN 1.2.0-2/lib/rubygems/config_file.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/config_file.rb
--- 1.2.0-2/lib/rubygems/config_file.rb	2008-06-18 09:25:20.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/config_file.rb	2008-08-27 17:30:06.000000000 +0100
@@ -18,6 +18,18 @@ class Gem::ConfigFile
   DEFAULT_VERBOSITY = true
   DEFAULT_UPDATE_SOURCES = true
 
+  ##
+  # For Ruby packagers to set configuration defaults.  Set in
+  # rubygems/defaults/operating_system.rb
+
+  OPERATING_SYSTEM_DEFAULTS = {}
+
+  ##
+  # For Ruby implementers to set configuration defaults.  Set in
+  # rubygems/defaults/#{RUBY_ENGINE}.rb
+
+  PLATFORM_DEFAULTS = {}
+
   system_config_path = 
     begin
       require 'Win32API'
@@ -98,8 +110,14 @@ class Gem::ConfigFile
     @verbose = DEFAULT_VERBOSITY
     @update_sources = DEFAULT_UPDATE_SOURCES
 
-    @hash = load_file(SYSTEM_WIDE_CONFIG_FILE)
-    @hash.merge!(load_file(config_file_name.dup.untaint))
+    operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS)
+    platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
+    system_config = load_file SYSTEM_WIDE_CONFIG_FILE
+    user_config = load_file config_file_name.dup.untaint
+
+    @hash = operating_system_config.merge platform_config
+    @hash = @hash.merge system_config
+    @hash = @hash.merge user_config
 
     # HACK these override command-line args, which is bad
     @backtrace = @hash[:backtrace] if @hash.key? :backtrace
diff -pruN 1.2.0-2/lib/rubygems/defaults.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/defaults.rb
--- 1.2.0-2/lib/rubygems/defaults.rb	2008-06-05 03:34:47.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/defaults.rb	2008-08-27 17:30:06.000000000 +0100
@@ -11,17 +11,21 @@ module Gem
     if defined? RUBY_FRAMEWORK_VERSION then
       File.join File.dirname(ConfigMap[:sitedir]), 'Gems',
                 ConfigMap[:ruby_version]
-    elsif defined? RUBY_ENGINE then
-      File.join ConfigMap[:libdir], RUBY_ENGINE, 'gems',
-                ConfigMap[:ruby_version]
     else
-      File.join ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version]
+      File.join(ConfigMap[:libdir], ruby_engine, 'gems',
+                ConfigMap[:ruby_version])
     end
   end
 
-  # Default gem path.
+  # Path for gems in the user's home directory.
+  def self.user_dir
+    File.join(Gem.user_home, '.gem', ruby_engine,
+              ConfigMap[:ruby_version])
+  end
+
+  # Default gem load path.
   def self.default_path
-    default_dir
+    [user_dir, default_dir]
   end
 
   # Deduce Ruby's --program-prefix and --program-suffix from its install name.
@@ -49,5 +53,13 @@ module Gem
     File.join Gem.user_home, '.gem', 'source_cache'
   end
 
+  # A wrapper around RUBY_ENGINE const that may not be defined.
+  def self.ruby_engine
+    if defined? RUBY_ENGINE
+      RUBY_ENGINE
+    else
+      'ruby'
+    end
+  end
 end
 
diff -pruN 1.2.0-2/lib/rubygems/dependency_installer.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/dependency_installer.rb
--- 1.2.0-2/lib/rubygems/dependency_installer.rb	2008-06-20 20:55:40.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/dependency_installer.rb	2008-08-27 17:30:06.000000000 +0100
@@ -38,9 +38,17 @@ class Gem::DependencyInstaller
   # :ignore_dependencies:: Don't install any dependencies.
   # :install_dir:: See Gem::Installer#install.
   # :security_policy:: See Gem::Installer::new and Gem::Security.
+  # :user_install:: See Gem::Installer.new
   # :wrappers:: See Gem::Installer::new
 
   def initialize(options = {})
+    if options[:install_dir] then
+      spec_dir = options[:install_dir], 'specifications'
+      @source_index = Gem::SourceIndex.from_gems_in spec_dir
+    else
+      @source_index = Gem.source_index
+    end
+
     options = DEFAULT_OPTIONS.merge options
 
     @bin_dir = options[:bin_dir]
@@ -51,19 +59,13 @@ class Gem::DependencyInstaller
     @format_executable = options[:format_executable]
     @ignore_dependencies = options[:ignore_dependencies]
     @security_policy = options[:security_policy]
+    @user_install = options[:user_install]
     @wrappers = options[:wrappers]
 
     @installed_gems = []
 
     @install_dir = options[:install_dir] || Gem.dir
     @cache_dir = options[:cache_dir] || @install_dir
-
-    if options[:install_dir] then
-      spec_dir = File.join @install_dir, 'specifications'
-      @source_index = Gem::SourceIndex.from_gems_in spec_dir
-    else
-      @source_index = Gem.source_index
-    end
   end
 
   ##
@@ -232,15 +234,17 @@ class Gem::DependencyInstaller
       end
 
       inst = Gem::Installer.new local_gem_path,
-                                :env_shebang => @env_shebang,
-                                :force => @force,
-                                :format_executable => @format_executable,
+                                :bin_dir             => @bin_dir,
+                                :development         => @development,
+                                :env_shebang         => @env_shebang,
+                                :force               => @force,
+                                :format_executable   => @format_executable,
                                 :ignore_dependencies => @ignore_dependencies,
-                                :install_dir => @install_dir,
-                                :security_policy => @security_policy,
-                                :wrappers => @wrappers,
-                                :bin_dir => @bin_dir,
-                                :development => @development
+                                :install_dir         => @install_dir,
+                                :security_policy     => @security_policy,
+                                :source_index        => @source_index,
+                                :user_install        => @user_install,
+                                :wrappers            => @wrappers
 
       spec = inst.install
 
diff -pruN 1.2.0-2/lib/rubygems/ext/rake_builder.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/ext/rake_builder.rb
--- 1.2.0-2/lib/rubygems/ext/rake_builder.rb	2007-08-16 04:43:16.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/ext/rake_builder.rb	2008-08-27 17:30:06.000000000 +0100
@@ -16,7 +16,7 @@ class Gem::Ext::RakeBuilder < Gem::Ext::
     end
 
     cmd = ENV['rake'] || 'rake'
-    cmd << " RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}"
+    cmd += " RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}" # ENV is frozen
 
     run cmd, results
 
diff -pruN 1.2.0-2/lib/rubygems/gem_path_searcher.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/gem_path_searcher.rb
--- 1.2.0-2/lib/rubygems/gem_path_searcher.rb	2007-12-20 00:25:24.000000000 +0000
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/gem_path_searcher.rb	2008-08-27 17:30:06.000000000 +0100
@@ -6,15 +6,15 @@
 
 require 'rubygems'
 
-#
+##
 # GemPathSearcher has the capability to find loadable files inside
 # gems.  It generates data up front to speed up searches later.
-#
+
 class Gem::GemPathSearcher
 
-  #
+  ##
   # Initialise the data we need to make searches later.
-  #
+
   def initialize
     # We want a record of all the installed gemspecs, in the order
     # we wish to examine them.
@@ -27,7 +27,7 @@ class Gem::GemPathSearcher
     end
   end
 
-  # 
+  ##
   # Look in all the installed gems until a matching _path_ is found.
   # Return the _gemspec_ of the gem where it was found.  If no match
   # is found, return nil.
@@ -46,36 +46,52 @@ class Gem::GemPathSearcher
   # others), which may or may not already be attached to _file_.
   # This method doesn't care about the full filename that matches;
   # only that there is a match.
-  # 
+
   def find(path)
-    @gemspecs.each do |spec|
-      return spec if matching_file(spec, path)
+    @gemspecs.find do |spec| matching_file? spec, path end
+  end
+
+  ##
+  # Works like #find, but finds all gemspecs matching +path+.
+
+  def find_all(path)
+    @gemspecs.select do |spec|
+      matching_file? spec, path
     end
-    nil
   end
 
-  private
+  ##
+  # Attempts to find a matching path using the require_paths of the given
+  # +spec+.
 
-  # Attempts to find a matching path using the require_paths of the
-  # given _spec_.
-  #
-  # Some of the intermediate results are cached in @lib_dirs for
-  # speed.
-  def matching_file(spec, path)  # :doc:
+  def matching_file?(spec, path)
+    !matching_files(spec, path).empty?
+  end
+
+  ##
+  # Returns files matching +path+ in +spec+.
+  #--
+  # Some of the intermediate results are cached in @lib_dirs for speed.
+
+  def matching_files(spec, path)
     glob = File.join @lib_dirs[spec.object_id], "#{path}#{Gem.suffix_pattern}"
-    return true unless Dir[glob].select { |f| File.file?(f.untaint) }.empty?
+    Dir[glob].select { |f| File.file? f.untaint }
   end
 
-  # Return a list of all installed gemspecs, sorted by alphabetical
-  # order and in reverse version order.
+  ##
+  # Return a list of all installed gemspecs, sorted by alphabetical order and
+  # in reverse version order.
+
   def init_gemspecs
     Gem.source_index.map { |_, spec| spec }.sort { |a,b|
       (a.name <=> b.name).nonzero? || (b.version <=> a.version)
     }
   end
 
+  ##
   # Returns library directories glob for a gemspec.  For example,
   #   '/usr/local/lib/ruby/gems/1.8/gems/foobar-1.0/{lib,ext}'
+
   def lib_dirs_for(spec)
     "#{spec.full_gem_path}/{#{spec.require_paths.join(',')}}"
   end
diff -pruN 1.2.0-2/lib/rubygems/indexer.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/indexer.rb
--- 1.2.0-2/lib/rubygems/indexer.rb	2008-06-22 02:32:42.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/indexer.rb	2008-08-27 17:30:06.000000000 +0100
@@ -116,7 +116,7 @@ class Gem::Indexer
     open @specs_index, 'wb' do |io|
       specs = index.sort.map do |_, spec|
         platform = spec.original_platform
-        platform = Gem::Platform::RUBY if platform.nil?
+        platform = Gem::Platform::RUBY if platform.nil? or platform.empty?
         [spec.name, spec.version, platform]
       end
 
@@ -129,7 +129,9 @@ class Gem::Indexer
 
     open @latest_specs_index, 'wb' do |io|
       specs = index.latest_specs.sort.map do |spec|
-        [spec.name, spec.version, spec.original_platform]
+        platform = spec.original_platform
+        platform = Gem::Platform::RUBY if platform.nil? or platform.empty?
+        [spec.name, spec.version, platform]
       end
 
       specs = compact_specs specs
@@ -283,10 +285,7 @@ class Gem::Indexer
   # Builds and installs indexicies.
 
   def generate_index
-    FileUtils.rm_rf @directory
-    FileUtils.mkdir_p @directory, :mode => 0700
-    FileUtils.mkdir_p @quick_marshal_dir
-
+    make_temp_directories
     index = collect_specs
     build_indicies index
     install_indicies
@@ -323,6 +322,15 @@ class Gem::Indexer
   end
 
   ##
+  # Make directories for index generation
+
+  def make_temp_directories
+    FileUtils.rm_rf @directory
+    FileUtils.mkdir_p @directory, :mode => 0700
+    FileUtils.mkdir_p @quick_marshal_dir
+  end
+
+  ##
   # Ensure +path+ and path with +extension+ are identical.
 
   def paranoid(path, extension)
@@ -344,6 +352,7 @@ class Gem::Indexer
     spec.description = sanitize_string(spec.description)
     spec.post_install_message = sanitize_string(spec.post_install_message)
     spec.authors = spec.authors.collect { |a| sanitize_string(a) }
+
     spec
   end
 
diff -pruN 1.2.0-2/lib/rubygems/installer.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/installer.rb
--- 1.2.0-2/lib/rubygems/installer.rb	2008-06-07 01:15:11.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/installer.rb	2008-08-27 17:30:06.000000000 +0100
@@ -20,6 +20,7 @@ require 'rubygems/require_paths_builder'
 # filesystem including unpacking the gem into its gem dir, installing the
 # gemspec in the specifications dir, storing the cached gem in the cache dir,
 # and installing either wrappers or symlinks for executables.
+
 class Gem::Installer
 
   ##
@@ -31,8 +32,30 @@ class Gem::Installer
 
   include Gem::RequirePathsBuilder
 
+  ##
+  # The directory a gem's executables will be installed into
+
+  attr_reader :bin_dir
+
+  ##
+  # The gem repository the gem will be installed into
+
+  attr_reader :gem_home
+
+  ##
+  # The Gem::Specification for the gem being installed
+
+  attr_reader :spec
+
+  @home_install_warning = false
+
   class << self
 
+    ##
+    # True if we've warned about ~/.gems install
+
+    attr_accessor :home_install_warning
+
     attr_writer :exec_format
 
     # Defaults to use Ruby's program prefix and suffix.
@@ -61,11 +84,12 @@ class Gem::Installer
     @gem = gem
 
     options = {
-      :force => false,
-      :install_dir => Gem.dir,
-      :exec_format => false,
-      :env_shebang => false,
-      :bin_dir => nil
+      :bin_dir      => nil,
+      :env_shebang  => false,
+      :exec_format  => false,
+      :force        => false,
+      :install_dir  => Gem.dir,
+      :source_index => Gem.source_index,
     }.merge options
 
     @env_shebang = options[:env_shebang]
@@ -78,6 +102,7 @@ class Gem::Installer
     @wrappers = options[:wrappers]
     @bin_dir = options[:bin_dir]
     @development = options[:development]
+    @source_index = options[:source_index]
 
     begin
       @format = Gem::Format.from_file_by_path @gem, @security_policy
@@ -85,6 +110,41 @@ class Gem::Installer
       raise Gem::InstallError, "invalid gem format for #{@gem}"
     end
 
+    begin
+      FileUtils.mkdir_p @gem_home
+    rescue Errno::EACCESS, Errno::ENOTDIR
+      # We'll divert to ~/.gems below
+    end
+
+    if not File.writable? @gem_home or
+        # TODO: Shouldn't have to test for existence of bindir; tests need it.
+        (@gem_home.to_s == Gem.dir and File.exist? Gem.bindir and
+         not File.writable? Gem.bindir) then
+      if options[:user_install] == false then # You don't want to use ~
+        raise Gem::FilePermissionError, @gem_home
+      elsif options[:user_install].nil? then
+        unless self.class.home_install_warning then
+          say "Warning: falling back to ~/.gem install since #{@gem_home} and #{Gem.bindir} aren't both writable."
+          self.class.home_install_warning = true
+        end
+      end
+      options[:user_install] = true
+    end
+
+    if options[:user_install] then
+      @gem_home = Gem.user_dir
+
+      user_bin_dir = File.join(@gem_home, 'bin')
+      unless ENV['PATH'].split(File::PATH_SEPARATOR).include? user_bin_dir then
+        say "You don't have #{user_bin_dir} in your PATH."
+        say "You won't be able to run gem-installed executables until you add it."
+      end
+
+      FileUtils.mkdir_p @gem_home unless File.directory? @gem_home
+      # If it's still not writable, you've got issues.
+      raise Gem::FilePermissionError, @gem_home unless File.writable? @gem_home
+    end
+
     @spec = @format.spec
 
     @gem_dir = File.join(@gem_home, "gems", @spec.full_name).untaint
@@ -131,8 +191,11 @@ class Gem::Installer
       end
     end
 
+    Gem.pre_install_hooks.each do |hook|
+      hook.call self
+    end
+
     FileUtils.mkdir_p @gem_home unless File.directory? @gem_home
-    raise Gem::FilePermissionError, @gem_home unless File.writable? @gem_home
 
     Gem.ensure_gem_subdirectories @gem_home
 
@@ -156,7 +219,11 @@ class Gem::Installer
     @spec.loaded_from = File.join(@gem_home, 'specifications',
                                   "#{@spec.full_name}.gemspec")
 
-    Gem.source_index.add_spec @spec
+    @source_index.add_spec @spec
+
+    Gem.post_install_hooks.each do |hook|
+      hook.call self
+    end
 
     return @spec
   rescue Zlib::GzipFile::Error
@@ -179,10 +246,10 @@ class Gem::Installer
   end
 
   ##
-  # True if the gems in Gem.source_index satisfy +dependency+.
+  # True if the gems in the source_index satisfy +dependency+.
 
   def installation_satisfies_dependency?(dependency)
-    Gem.source_index.find_name(dependency.name, dependency.version_requirements).size > 0
+    @source_index.find_name(dependency.name, dependency.version_requirements).size > 0
   end
 
   ##
@@ -206,6 +273,7 @@ class Gem::Installer
 
     file_name = File.join @gem_home, 'specifications',
                           "#{@spec.full_name}.gemspec"
+
     file_name.untaint
 
     File.open(file_name, "w") do |file|
diff -pruN 1.2.0-2/lib/rubygems/install_update_options.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/install_update_options.rb
--- 1.2.0-2/lib/rubygems/install_update_options.rb	2008-05-07 03:15:51.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/install_update_options.rb	2008-08-27 17:30:06.000000000 +0100
@@ -90,6 +90,13 @@ module Gem::InstallUpdateOptions
       options[:format_executable] = value
     end
 
+    add_option(:"Install/Update",       '--[no-]user-install',
+               'Install in user\'s home directory instead',
+               'of GEM_HOME. Defaults to using home directory',
+               'only if GEM_HOME is not writable.') do |value, options|
+      options[:user_install] = value
+    end
+
     add_option(:"Install/Update", "--development",
                 "Install any additional development",
                 "dependencies") do |value, options|
diff -pruN 1.2.0-2/lib/rubygems/local_remote_options.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/local_remote_options.rb
--- 1.2.0-2/lib/rubygems/local_remote_options.rb	2008-06-05 21:55:37.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/local_remote_options.rb	2008-08-27 17:30:06.000000000 +0100
@@ -110,6 +110,13 @@ module Gem::LocalRemoteOptions
   end
 
   ##
+  # Is fetching of local and remote information enabled?
+
+  def both?
+    options[:domain] == :both
+  end
+
+  ##
   # Is local fetching enabled?
 
   def local?
diff -pruN 1.2.0-2/lib/rubygems/package/tar_reader.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/package/tar_reader.rb
--- 1.2.0-2/lib/rubygems/package/tar_reader.rb	2008-02-29 08:55:01.000000000 +0000
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/package/tar_reader.rb	2008-08-27 17:30:06.000000000 +0100
@@ -46,17 +46,17 @@ class Gem::Package::TarReader
       yield entry
 
       skip = (512 - (size % 512)) % 512
+      pending = size - entry.bytes_read
 
-      if @io.respond_to? :seek then
+      begin
         # avoid reading...
-        @io.seek(size - entry.bytes_read, IO::SEEK_CUR)
-      else
-        pending = size - entry.bytes_read
-
+        @io.seek pending, IO::SEEK_CUR
+        pending = 0
+      rescue Errno::EINVAL, NameError
         while pending > 0 do
-          bread = @io.read([pending, 4096].min).size
+          bytes_read = @io.read([pending, 4096].min).size
           raise UnexpectedEOF if @io.eof?
-          pending -= bread
+          pending -= bytes_read
         end
       end
 
diff -pruN 1.2.0-2/lib/rubygems/platform.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/platform.rb
--- 1.2.0-2/lib/rubygems/platform.rb	2008-06-16 07:14:45.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/platform.rb	2008-08-27 17:30:06.000000000 +0100
@@ -13,23 +13,6 @@ class Gem::Platform
 
   attr_accessor :version
 
-  DEPRECATED_CONSTS = [
-    :DARWIN,
-    :LINUX_586,
-    :MSWIN32,
-    :PPC_DARWIN,
-    :WIN32,
-    :X86_LINUX
-  ]
-
-  def self.const_missing(name) # TODO remove six months from 2007/12
-    if DEPRECATED_CONSTS.include? name then
-      raise NameError, "#{name} has been removed, use CURRENT instead"
-    else
-      super
-    end
-  end
-
   def self.local
     arch = Gem::ConfigMap[:arch]
     arch = "#{arch}_60" if arch =~ /mswin32$/
diff -pruN 1.2.0-2/lib/rubygems/remote_fetcher.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/remote_fetcher.rb
--- 1.2.0-2/lib/rubygems/remote_fetcher.rb	2008-06-21 22:21:17.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/remote_fetcher.rb	2008-08-27 17:30:06.000000000 +0100
@@ -1,5 +1,6 @@
 require 'net/http'
 require 'stringio'
+require 'time'
 require 'uri'
 
 require 'rubygems'
@@ -74,7 +75,12 @@ class Gem::RemoteFetcher
   # always replaced.
 
   def download(spec, source_uri, install_dir = Gem.dir)
-    cache_dir = File.join install_dir, 'cache'
+    if File.writable?(install_dir)
+      cache_dir = File.join install_dir, 'cache'
+    else
+      cache_dir = File.join(Gem.user_dir, 'cache')
+    end
+
     gem_file_name = "#{spec.full_name}.gem"
     local_gem_path = File.join cache_dir, gem_file_name
 
@@ -87,7 +93,7 @@ class Gem::RemoteFetcher
     scheme = nil if scheme =~ /^[a-z]$/i
 
     case scheme
-    when 'http' then
+    when 'http', 'https' then
       unless File.exist? local_gem_path then
         begin
           say "Downloading gem #{gem_file_name}" if
@@ -132,51 +138,27 @@ class Gem::RemoteFetcher
   ##
   # Downloads +uri+ and returns it as a String.
 
-  def fetch_path(uri)
-    open_uri_or_path(uri) do |input|
-      input.read
-    end
+  def fetch_path(uri, mtime = nil, head = false)
+    data = open_uri_or_path uri, mtime, head
+    data = Gem.gunzip data if data and not head and uri.to_s =~ /gz$/
+    data
   rescue FetchError
     raise
   rescue Timeout::Error
     raise FetchError.new('timed out', uri)
   rescue IOError, SocketError, SystemCallError => e
     raise FetchError.new("#{e.class}: #{e}", uri)
-  rescue => e
-    raise FetchError.new("#{e.class}: #{e}", uri)
   end
 
   ##
   # Returns the size of +uri+ in bytes.
 
-  def fetch_size(uri)
-    return File.size(get_file_uri_path(uri)) if file_uri? uri
-
-    uri = URI.parse uri unless URI::Generic === uri
-
-    raise ArgumentError, 'uri is not an HTTP URI' unless URI::HTTP === uri
-
-    response = request uri, Net::HTTP::Head
+  def fetch_size(uri) # TODO: phase this out
+    response = fetch_path(uri, nil, true)
 
-    case response
-    when Net::HTTPOK then
-    else
-      raise FetchError.new("bad response #{response.message} #{response.code}", uri)
-    end
-
-    if response['content-length'] then
-      return response['content-length'].to_i
-    else
-      response = http.get uri.request_uri
-      return response.body.size
-    end
-
-  rescue SocketError, SystemCallError, Timeout::Error => e
-    raise FetchError.new("#{e.message} (#{e.class})\n\tfetching size", uri)
+    response['content-length'].to_i
   end
 
-  private
-
   def escape(str)
     return unless str
     URI.escape(str)
@@ -234,8 +216,9 @@ class Gem::RemoteFetcher
     connection = @connections[connection_id]
 
     if uri.scheme == 'https' and not connection.started? then
-      http_obj.use_ssl = true
-      http_obj.verify_mode = OpenSSL::SSL::VERIFY_NONE
+      require 'net/https'
+      connection.use_ssl = true
+      connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
     end
 
     connection.start unless connection.started?
@@ -247,24 +230,27 @@ class Gem::RemoteFetcher
   # Read the data from the (source based) URI, but if it is a file:// URI,
   # read from the filesystem instead.
 
-  def open_uri_or_path(uri, depth = 0, &block)
-    if file_uri?(uri)
-      open(get_file_uri_path(uri), &block)
-    else
-      uri = URI.parse uri unless URI::Generic === uri
+  def open_uri_or_path(uri, last_modified = nil, head = false, depth = 0)
+    raise "block is dead" if block_given?
 
-      response = request uri
+    return open(get_file_uri_path(uri)) if file_uri? uri
 
-      case response
-      when Net::HTTPOK then
-        block.call(StringIO.new(response.body)) if block
-      when Net::HTTPRedirection then
-        raise FetchError.new('too many redirects', uri) if depth > 10
-
-        open_uri_or_path(response['Location'], depth + 1, &block)
-      else
-        raise FetchError.new("bad response #{response.message} #{response.code}", uri)
-      end
+    uri = URI.parse uri unless URI::Generic === uri
+    raise ArgumentError, 'uri is not an HTTP URI' unless URI::HTTP === uri
+
+    fetch_type = head ? Net::HTTP::Head : Net::HTTP::Get
+    response   = request uri, fetch_type, last_modified
+
+    case response
+    when Net::HTTPOK, Net::HTTPNotModified then
+      head ? response : response.body
+    when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther,
+         Net::HTTPTemporaryRedirect then
+      raise FetchError.new('too many redirects', uri) if depth > 10
+
+      open_uri_or_path(response['Location'], last_modified, head, depth + 1)
+    else
+      raise FetchError.new("bad response #{response.message} #{response.code}", uri)
     end
   end
 
@@ -273,7 +259,7 @@ class Gem::RemoteFetcher
   # a Net::HTTP response object.  request maintains a table of persistent
   # connections to reduce connect overhead.
 
-  def request(uri, request_class = Net::HTTP::Get)
+  def request(uri, request_class, last_modified = nil)
     request = request_class.new uri.request_uri
 
     unless uri.nil? || uri.user.nil? || uri.user.empty? then
@@ -289,14 +275,16 @@ class Gem::RemoteFetcher
     request.add_field 'Connection', 'keep-alive'
     request.add_field 'Keep-Alive', '30'
 
+    if last_modified then
+      last_modified = last_modified.utc
+      request.add_field 'If-Modified-Since', last_modified.rfc2822
+    end
+
     connection = connection_for uri
 
     retried = false
     bad_response = false
 
-    # HACK work around EOFError bug in Net::HTTP
-    # NOTE Errno::ECONNABORTED raised a lot on Windows, and make impossible
-    # to install gems.
     begin
       @requests[connection.object_id] += 1
       response = connection.request request
@@ -309,6 +297,9 @@ class Gem::RemoteFetcher
 
       bad_response = true
       retry
+    # HACK work around EOFError bug in Net::HTTP
+    # NOTE Errno::ECONNABORTED raised a lot on Windows, and make impossible
+    # to install gems.
     rescue EOFError, Errno::ECONNABORTED, Errno::ECONNRESET
       requests = @requests[connection.object_id]
       say "connection reset after #{requests} requests, retrying" if
diff -pruN 1.2.0-2/lib/rubygems/source_index.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/source_index.rb
--- 1.2.0-2/lib/rubygems/source_index.rb	2008-06-20 20:55:34.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/source_index.rb	2008-08-27 17:30:06.000000000 +0100
@@ -93,7 +93,7 @@ class Gem::SourceIndex
         alert_warning e
         alert_warning spec_code
       rescue Exception => e
-        alert_warning(e.inspect.to_s + "\n" + spec_code)
+        alert_warning "#{e.inspect}\n#{spec_code}"
         alert_warning "Invalid .gemspec format in '#{file_name}'"
       end
       return nil
@@ -230,7 +230,8 @@ class Gem::SourceIndex
   # Find a gem by an exact match on the short name.
 
   def find_name(gem_name, version_requirement = Gem::Requirement.default)
-    search(/^#{gem_name}$/, version_requirement)
+    dep = Gem::Dependency.new(/^#{gem_name}$/, version_requirement)
+    search dep
   end
 
   ##
@@ -246,7 +247,13 @@ class Gem::SourceIndex
     version_requirement = nil
     only_platform = false
 
-    case gem_pattern # TODO warn after 2008/03, remove three months after
+    # TODO - Remove support and warning for legacy arguments after 2008/11
+    unless Gem::Dependency === gem_pattern
+      warn "Gem::SourceIndex#search support for #{gem_pattern.class} patterns is deprecated"
+      warn "#{caller[0]} is outdated" 
+    end
+
+    case gem_pattern
     when Regexp then
       version_requirement = platform_only || Gem::Requirement.default
     when Gem::Dependency then
@@ -270,7 +277,7 @@ class Gem::SourceIndex
 
     specs = @gems.values.select do |spec|
       spec.name =~ gem_pattern and
-      version_requirement.satisfied_by? spec.version
+        version_requirement.satisfied_by? spec.version
     end
 
     if only_platform then
@@ -539,7 +546,7 @@ module Gem
   # objects to load properly.
   Cache = SourceIndex
 
-  # :starddoc:
+  # :startdoc:
 
 end
 
diff -pruN 1.2.0-2/lib/rubygems/source_info_cache.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/source_info_cache.rb
--- 1.2.0-2/lib/rubygems/source_info_cache.rb	2008-06-17 21:59:40.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/source_info_cache.rb	2008-08-27 17:30:06.000000000 +0100
@@ -284,6 +284,10 @@ class Gem::SourceInfoCache
 
     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) 
+      end
       sic_entry.source_index.search pattern, platform_only
     end.flatten.compact
   end
@@ -300,6 +304,11 @@ class Gem::SourceInfoCache
     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) 
+      end
+
       sic_entry.source_index.search(pattern, only_platform).each do |spec|
         results << [spec, source_uri]
       end
diff -pruN 1.2.0-2/lib/rubygems/spec_fetcher.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/spec_fetcher.rb
--- 1.2.0-2/lib/rubygems/spec_fetcher.rb	2008-06-17 22:35:37.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/spec_fetcher.rb	2008-08-27 17:30:06.000000000 +0100
@@ -167,7 +167,7 @@ class Gem::SpecFetcher
 
       if all and @specs.include? source_uri then
         list[source_uri] = @specs[source_uri]
-      elsif @latest_specs.include? source_uri then
+      elsif not all and @latest_specs.include? source_uri then
         list[source_uri] = @latest_specs[source_uri]
       else
         specs = load_specs source_uri, file
@@ -182,30 +182,28 @@ class Gem::SpecFetcher
     list
   end
 
-  def load_specs(source_uri, file)
-    file_name = "#{file}.#{Gem.marshal_version}.gz"
-
-    spec_path = source_uri + file_name
-
-    cache_dir = cache_dir spec_path
+  ##
+  # Loads specs in +file+, fetching from +source_uri+ if the on-disk cache is
+  # out of date.
 
-    local_file = File.join(cache_dir, file_name).chomp '.gz'
+  def load_specs(source_uri, file)
+    file_name  = "#{file}.#{Gem.marshal_version}"
+    spec_path  = source_uri + "#{file_name}.gz"
+    cache_dir  = cache_dir spec_path
+    local_file = File.join(cache_dir, file_name)
+    loaded     = false
 
     if File.exist? local_file then
-      local_size = File.stat(local_file).size
-
-      remote_file = spec_path.dup
-      remote_file.path = remote_file.path.chomp '.gz'
-      remote_size = @fetcher.fetch_size remote_file
+      spec_dump = @fetcher.fetch_path spec_path, File.mtime(local_file)
 
-      spec_dump = Gem.read_binary local_file if remote_size == local_size
-    end
-
-    unless spec_dump then
+      if spec_dump.nil? then
+        spec_dump = Gem.read_binary local_file
+      else
+        loaded = true
+      end
+    else
+      spec_dump = @fetcher.fetch_path spec_path
       loaded = true
-
-      spec_dump_gz = @fetcher.fetch_path spec_path
-      spec_dump = Gem.gunzip spec_dump_gz
     end
 
     specs = Marshal.load spec_dump
diff -pruN 1.2.0-2/lib/rubygems/specification.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/specification.rb
--- 1.2.0-2/lib/rubygems/specification.rb	2008-06-21 22:54:48.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/specification.rb	2008-08-27 17:30:06.000000000 +0100
@@ -24,6 +24,7 @@ class Date; end # for ruby_code if date.
 
 module Gem
 
+  ##
   # == Gem::Specification
   #
   # The Specification class contains the metadata for a Gem.  Typically
@@ -38,7 +39,7 @@ module Gem
   #
   # There are many <em>gemspec attributes</em>, and the best place to learn
   # about them in the "Gemspec Reference" linked from the RubyGems wiki.
-  #
+
   class Specification
 
     ##
@@ -46,8 +47,6 @@ module Gem
 
     attr_accessor :original_platform # :nodoc:
 
-    # ------------------------- Specification version constants.
-
     ##
     # The the version number of a specification that does not specify one
     # (i.e. RubyGems 0.7 or earlier).
@@ -88,77 +87,98 @@ module Gem
     TODAY = now - ((now.to_i + now.gmt_offset) % 86400)
     # :startdoc:
 
-    # ------------------------- Class variables.
-
+    ##
     # List of Specification instances.
+
     @@list = []
 
+    ##
     # Optional block used to gather newly defined instances.
+
     @@gather = nil
 
+    ##
     # List of attribute names: [:name, :version, ...]
     @@required_attributes = []
 
-    # List of _all_ attributes and default values: [[:name, nil], [:bindir, 'bin'], ...]
+    ##
+    # List of _all_ attributes and default values:
+    #
+    #   [[:name, nil],
+    #    [:bindir, 'bin'],
+    #    ...]
+
     @@attributes = []
 
     @@nil_attributes = []
     @@non_nil_attributes = [:@original_platform]
 
+    ##
     # List of array attributes
+
     @@array_attributes = []
 
+    ##
     # Map of attribute names to default values.
+
     @@default_value = {}
 
-    # ------------------------- Convenience class methods.
+    ##
+    # Names of all specification attributes
 
     def self.attribute_names
       @@attributes.map { |name, default| name }
     end
 
+    ##
+    # Default values for specification attributes
+
     def self.attribute_defaults
       @@attributes.dup
     end
 
+    ##
+    # The default value for specification attribute +name+
+
     def self.default_value(name)
       @@default_value[name]
     end
 
+    ##
+    # Required specification attributes
+
     def self.required_attributes
       @@required_attributes.dup
     end
 
+    ##
+    # Is +name+ a required attribute?
+
     def self.required_attribute?(name)
       @@required_attributes.include? name.to_sym
     end
 
+    ##
+    # Specification attributes that are arrays (appendable and so-forth)
+
     def self.array_attributes
       @@array_attributes.dup
     end
 
-    # ------------------------- Infrastructure class methods.
+    ##
+    # A list of Specification instances that have been defined in this Ruby
+    # instance.
 
-    # A list of Specification instances that have been defined in this Ruby instance.
     def self.list
       @@list
     end
 
-    # Used to specify the name and default value of a specification
-    # attribute.  The side effects are:
-    # * the name and default value are added to the @@attributes list
-    #   and @@default_value map
-    # * a standard _writer_ method (<tt>attribute=</tt>) is created
-    # * a non-standard _reader method (<tt>attribute</tt>) is created
-    #
-    # The reader method behaves like this:
-    #   def attribute
-    #     @attribute ||= (copy of default value)
-    #   end
-    #
-    # This allows lazy initialization of attributes to their default
-    # values. 
+    ##
+    # Specifies the +name+ and +default+ for a specification attribute, and
+    # creates a reader and writer method like Module#attr_accessor.
     #
+    # The reader method returns the default if the value hasn't been set.
+
     def self.attribute(name, default=nil)
       ivar_name = "@#{name}".intern
       if default.nil? then
@@ -172,8 +192,10 @@ module Gem
       attr_accessor(name)
     end
 
-    # Same as :attribute, but ensures that values assigned to the
-    # attribute are array values by applying :to_a to the value.
+    ##
+    # Same as :attribute, but ensures that values assigned to the attribute
+    # are array values by applying :to_a to the value.
+
     def self.array_attribute(name)
       @@non_nil_attributes << ["@#{name}".intern, []]
 
@@ -192,51 +214,60 @@ module Gem
       module_eval code, __FILE__, __LINE__ - 9
     end
 
+    ##
     # Same as attribute above, but also records this attribute as mandatory.
+
     def self.required_attribute(*args)
       @@required_attributes << args.first
       attribute(*args)
     end
 
-    # Sometimes we don't want the world to use a setter method for a particular attribute.
+    ##
+    # Sometimes we don't want the world to use a setter method for a
+    # particular attribute.
+    #
     # +read_only+ makes it private so we can still use it internally.
+
     def self.read_only(*names)
       names.each do |name|
         private "#{name}="
       end
     end
 
-    # Shortcut for creating several attributes at once (each with a default value of
-    # +nil+).
+    # Shortcut for creating several attributes at once (each with a default
+    # value of +nil+).
+
     def self.attributes(*args)
       args.each do |arg|
         attribute(arg, nil)
       end
     end
 
-    # Some attributes require special behaviour when they are accessed.  This allows for
-    # that.
+    ##
+    # Some attributes require special behaviour when they are accessed.  This
+    # allows for that.
+
     def self.overwrite_accessor(name, &block)
       remove_method name
       define_method(name, &block)
     end
 
-    # Defines a _singular_ version of an existing _plural_ attribute
-    # (i.e. one whose value is expected to be an array).  This means
-    # just creating a helper method that takes a single value and
-    # appends it to the array.  These are created for convenience, so
-    # that in a spec, one can write 
+    ##
+    # Defines a _singular_ version of an existing _plural_ attribute (i.e. one
+    # whose value is expected to be an array).  This means just creating a
+    # helper method that takes a single value and appends it to the array.
+    # These are created for convenience, so that in a spec, one can write 
     #
     #   s.require_path = 'mylib'
     #
-    # instead of
+    # instead of:
     #
     #   s.require_paths = ['mylib']
     #
-    # That above convenience is available courtesy of
+    # That above convenience is available courtesy of:
     #
     #   attribute_alias_singular :require_path, :require_paths 
-    #
+
     def self.attribute_alias_singular(singular, plural)
       define_method("#{singular}=") { |val|
         send("#{plural}=", [val])
@@ -320,189 +351,45 @@ module Gem
       spec
     end
 
-    # REQUIRED gemspec attributes ------------------------------------
-    
-    required_attribute :rubygems_version, Gem::RubyGemsVersion
-    required_attribute :specification_version, CURRENT_SPECIFICATION_VERSION
-    required_attribute :name
-    required_attribute :version
-    required_attribute :date, TODAY
-    required_attribute :summary
-    required_attribute :require_paths, ['lib']
-
-    # OPTIONAL gemspec attributes ------------------------------------
-    
-    attributes :email, :homepage, :rubyforge_project, :description
-    attributes :autorequire, :default_executable
-
-    attribute :bindir,                     'bin'
-    attribute :has_rdoc,                   false
-    attribute :required_ruby_version,      Gem::Requirement.default
-    attribute :required_rubygems_version,  Gem::Requirement.default
-    attribute :platform,                   Gem::Platform::RUBY
-
-    attribute :signing_key,            nil
-    attribute :cert_chain,             []
-    attribute :post_install_message,   nil
-
-    array_attribute :authors
-    array_attribute :files
-    array_attribute :test_files
-    array_attribute :rdoc_options
-    array_attribute :extra_rdoc_files
-    array_attribute :executables
-
-    # Array of extensions to build.  See Gem::Installer#build_extensions for
-    # valid values.
-
-    array_attribute :extensions
-    array_attribute :requirements
-    array_attribute :dependencies
-
-    read_only :dependencies
+    ##
+    # List of depedencies that will automatically be activated at runtime.
 
     def runtime_dependencies
       dependencies.select { |d| d.type == :runtime || d.type == nil }
     end
 
+    ##
+    # List of dependencies that are used for development
+
     def development_dependencies
       dependencies.select { |d| d.type == :development }
     end
 
-    # ALIASED gemspec attributes -------------------------------------
-    
-    attribute_alias_singular :executable,   :executables
-    attribute_alias_singular :author,   :authors
-    attribute_alias_singular :require_path, :require_paths
-    attribute_alias_singular :test_file,    :test_files
-
-    # DEPRECATED gemspec attributes ----------------------------------
-    
-    def test_suite_file
+    def test_suite_file # :nodoc:
       warn 'test_suite_file deprecated, use test_files'
       test_files.first
     end
 
-    def test_suite_file=(val)
+    def test_suite_file=(val) # :nodoc:
       warn 'test_suite_file= deprecated, use test_files='
       @test_files = [] unless defined? @test_files
       @test_files << val
     end
 
+    ##
     # true when this gemspec has been loaded from a specifications directory.
     # This attribute is not persisted.
 
-    attr_writer :loaded
+    attr_accessor :loaded
 
+    ##
     # Path this gemspec was loaded from.  This attribute is not persisted.
-    attr_accessor :loaded_from
-
-    # Special accessor behaviours (overwriting default) --------------
-    
-    overwrite_accessor :version= do |version|
-      @version = Version.create(version)
-    end
-
-    overwrite_accessor :platform do
-      @new_platform
-    end
-
-    overwrite_accessor :platform= do |platform|
-      if @original_platform.nil? or
-         @original_platform == Gem::Platform::RUBY then
-        @original_platform = platform
-      end
-
-      case platform
-      when Gem::Platform::CURRENT then
-        @new_platform = Gem::Platform.local
-        @original_platform = @new_platform.to_s
-
-      when Gem::Platform then
-        @new_platform = platform
-
-      # legacy constants
-      when nil, Gem::Platform::RUBY then
-        @new_platform = Gem::Platform::RUBY
-      when 'mswin32' then # was Gem::Platform::WIN32
-        @new_platform = Gem::Platform.new 'x86-mswin32'
-      when 'i586-linux' then # was Gem::Platform::LINUX_586
-        @new_platform = Gem::Platform.new 'x86-linux'
-      when 'powerpc-darwin' then # was Gem::Platform::DARWIN
-        @new_platform = Gem::Platform.new 'ppc-darwin'
-      else
-        @new_platform = Gem::Platform.new platform
-      end
-
-      @platform = @new_platform.to_s
-
-      @new_platform
-    end
-
-    overwrite_accessor :required_ruby_version= do |value|
-      @required_ruby_version = Gem::Requirement.create(value)
-    end
-
-    overwrite_accessor :required_rubygems_version= do |value|
-      @required_rubygems_version = Gem::Requirement.create(value)
-    end
-
-    overwrite_accessor :date= do |date|
-      # We want to end up with a Time object with one-day resolution.
-      # This is the cleanest, most-readable, faster-than-using-Date
-      # way to do it.
-      case date
-      when String then
-        @date = if /\A(\d{4})-(\d{2})-(\d{2})\Z/ =~ date then
-                  Time.local($1.to_i, $2.to_i, $3.to_i)
-                else
-                  require 'time'
-                  Time.parse date
-                end
-      when Time then
-        @date = Time.local(date.year, date.month, date.day)
-      when Date then
-        @date = Time.local(date.year, date.month, date.day)
-      else
-        @date = TODAY
-      end
-    end
-
-    overwrite_accessor :date do
-      self.date = nil if @date.nil?  # HACK Sets the default value for date
-      @date
-    end
-
-    overwrite_accessor :summary= do |str|
-      @summary = if str then
-                   str.strip.
-                   gsub(/(\w-)\n[ \t]*(\w)/, '\1\2').
-                   gsub(/\n[ \t]*/, " ")
-                 end
-    end
 
-    overwrite_accessor :description= do |str|
-      @description = if str then
-                       str.strip.
-                       gsub(/(\w-)\n[ \t]*(\w)/, '\1\2').
-                       gsub(/\n[ \t]*/, " ")
-                     end
-    end
+    attr_accessor :loaded_from
 
-    overwrite_accessor :default_executable do
-      begin
-        if defined?(@default_executable) and @default_executable
-          result = @default_executable
-        elsif @executables and @executables.size == 1
-          result = Array(@executables).first
-        else
-          result = nil
-        end
-        result
-      rescue
-        nil
-      end
-    end
+    ##
+    # Returns an array with bindir attached to each executable in the
+    # executables list
 
     def add_bindir(executables)
       return nil if executables.nil?
@@ -516,17 +403,9 @@ module Gem
       return nil
     end
 
-    overwrite_accessor :files do
-      result = []
-      result.push(*@files) if defined?(@files)
-      result.push(*@test_files) if defined?(@test_files)
-      result.push(*(add_bindir(@executables)))
-      result.push(*@extra_rdoc_files) if defined?(@extra_rdoc_files)
-      result.push(*@extensions) if defined?(@extensions)
-      result.uniq.compact
-    end
-
+    ##
     # Files in the Gem under one of the require_paths
+
     def lib_files
       @files.select do |file|
         require_paths.any? do |path|
@@ -535,34 +414,25 @@ module Gem
       end
     end
 
-    overwrite_accessor :test_files do
-      # Handle the possibility that we have @test_suite_file but not
-      # @test_files.  This will happen when an old gem is loaded via
-      # YAML.
-      if defined? @test_suite_file then
-        @test_files = [@test_suite_file].flatten
-        @test_suite_file = nil
-      end
-      if defined?(@test_files) and @test_files then
-        @test_files
-      else
-        @test_files = []
-      end
+    ##
+    # True if this gem was loaded from disk
+
+    alias :loaded? :loaded
+
+    ##
+    # True if this gem has files in test_files
+
+    def has_unit_tests?
+      not test_files.empty?
     end
 
-    # Predicates -----------------------------------------------------
-    
-    def loaded?; @loaded ? true : false ; end
-    def has_rdoc?; has_rdoc ? true : false ; end
-    def has_unit_tests?; not test_files.empty?; end
-    alias has_test_suite? has_unit_tests?               # (deprecated)
-    
-    # Constructors ---------------------------------------------------
+    alias has_test_suite? has_unit_tests? # :nodoc: deprecated
     
+    ##
     # Specification constructor.  Assigns the default values to the
     # attributes, adds this spec to the list of loaded specs (see
     # Specification.list), and yields itself for further initialization.
-    #
+
     def initialize
       @new_platform = nil
       assign_defaults
@@ -575,11 +445,13 @@ module Gem
       @@gather.call(self) if @@gather
     end
 
-    # Each attribute has a default value (possibly nil).  Here, we
-    # initialize all attributes to their default value.  This is
-    # done through the accessor methods, so special behaviours will
-    # be honored.  Furthermore, we take a _copy_ of the default so
-    # each specification instance has its own empty arrays, etc.
+    ##
+    # Each attribute has a default value (possibly nil).  Here, we initialize
+    # all attributes to their default value.  This is done through the
+    # accessor methods, so special behaviours will be honored.  Furthermore,
+    # we take a _copy_ of the default so each specification instance has its
+    # own empty arrays, etc.
+
     def assign_defaults
       @@nil_attributes.each do |name|
         instance_variable_set name, nil
@@ -598,13 +470,14 @@ module Gem
       instance_variable_set :@new_platform, Gem::Platform::RUBY
     end
 
-    # Special loader for YAML files.  When a Specification object is
-    # loaded from a YAML file, it bypasses the normal Ruby object
-    # initialization routine (#initialize).  This method makes up for
-    # that and deals with gems of different ages.
+    ##
+    # Special loader for YAML files.  When a Specification object is loaded
+    # from a YAML file, it bypasses the normal Ruby object initialization
+    # routine (#initialize).  This method makes up for that and deals with
+    # gems of different ages.
     #
     # 'input' can be anything that YAML.load() accepts: String or IO. 
-    #
+
     def self.from_yaml(input)
       input = normalize_yaml_input input
       spec = YAML.load input
@@ -627,6 +500,9 @@ module Gem
       spec
     end 
 
+    ##
+    # Loads ruby format gemspec from +filename+
+
     def self.load(filename)
       gemspec = nil
       fail "NESTED Specification.load calls not allowed!" if @@gather
@@ -638,22 +514,25 @@ module Gem
       @@gather = nil
     end
 
-    # Make sure the yaml specification is properly formatted with dashes.
+    ##
+    # Make sure the YAML specification is properly formatted with dashes
+
     def self.normalize_yaml_input(input)
       result = input.respond_to?(:read) ? input.read : input
       result = "--- " + result unless result =~ /^--- /
       result
     end
     
-    # Instance methods -----------------------------------------------
-    
-    # Sets the rubygems_version to Gem::RubyGemsVersion.
-    #
+    ##
+    # Sets the rubygems_version to the current RubyGems version
+
     def mark_version
       @rubygems_version = RubyGemsVersion
     end
 
-    # Ignore unknown attributes if the 
+    ##
+    # Ignore unknown attributes while loading
+
     def method_missing(sym, *a, &b) # :nodoc:
       if @specification_version > CURRENT_SPECIFICATION_VERSION and
          sym.to_s =~ /=$/ then
@@ -663,35 +542,39 @@ module Gem
       end
     end
 
-    # Adds a development dependency to this Gem.  For example,
-    #
-    #   spec.add_development_dependency('jabber4r', '> 0.1', '<= 0.5')
+    ##
+    # Adds a development dependency named +gem+ with +requirements+ to this
+    # Gem.  For example:
     #
-    # Development dependencies aren't installed by default, and
-    # aren't activated when a gem is required.
+    #   spec.add_development_dependency 'jabber4r', '> 0.1', '<= 0.5'
     #
-    # gem:: [String or Gem::Dependency] The Gem name/dependency.
-    # requirements:: [default=">= 0"] The version requirements.
+    # Development dependencies aren't installed by default and aren't
+    # activated when a gem is required.
+
     def add_development_dependency(gem, *requirements)
       add_dependency_with_type(gem, :development, *requirements)
     end
 
-    # Adds a runtime dependency to this Gem.  For example,
-    #
-    #   spec.add_runtime_dependency('jabber4r', '> 0.1', '<= 0.5')
+    ##
+    # Adds a runtime dependency named +gem+ with +requirements+ to this Gem.
+    # For example:
     #
-    # gem:: [String or Gem::Dependency] The Gem name/dependency.
-    # requirements:: [default=">= 0"] The version requirements.
+    #   spec.add_runtime_dependency 'jabber4r', '> 0.1', '<= 0.5'
+
     def add_runtime_dependency(gem, *requirements)
       add_dependency_with_type(gem, :runtime, *requirements)
     end
 
+    ##
+    # Adds a runtime dependency
+
     alias add_dependency add_runtime_dependency
 
+    ##
     # Returns the full name (name-version) of this Gem.  Platform information
-    # is included (name-version-platform) if it is specified (and not the
-    # default Ruby platform).
-    #
+    # is included (name-version-platform) if it is specified and not the
+    # default Ruby platform.
+
     def full_name
       if platform == Gem::Platform::RUBY or platform.nil? then
         "#{@name}-#{@version}"
@@ -700,9 +583,10 @@ module Gem
       end
     end
 
+    ##
     # Returns the full name (name-version) of this gemspec using the original
-    # platform.
-    #
+    # platform.  For use with legacy gems.
+
     def original_name # :nodoc:
       if platform == Gem::Platform::RUBY or platform.nil? then
         "#{@name}-#{@version}"
@@ -736,18 +620,16 @@ module Gem
       File.expand_path path
     end
 
-    # Checks if this Specification meets the requirement of the supplied
-    # dependency.
-    # 
-    # dependency:: [Gem::Dependency] the dependency to check
-    # return:: [Boolean] true if dependency is met, otherwise false
-    #
+    ##
+    # Checks if this specification meets the requirement of +dependency+.
+
     def satisfies_requirement?(dependency)
       return @name == dependency.name && 
         dependency.version_requirements.satisfied_by?(@version)
     end
 
-    # Comparison methods ---------------------------------------------
+    ##
+    # Returns an object you can use to sort specifications in #sort_by.
 
     def sort_obj
       [@name, @version.to_ints, @new_platform == Gem::Platform::RUBY ? -1 : 1]
@@ -757,19 +639,25 @@ module Gem
       sort_obj <=> other.sort_obj
     end
 
+    ##
     # Tests specs for equality (across all attributes).
+
     def ==(other) # :nodoc:
       self.class === other && same_attributes?(other)
     end
 
     alias eql? == # :nodoc:
 
+    ##
+    # True if this gem has the same attributes as +other+.
+
     def same_attributes?(other)
       @@attributes.each do |name, default|
         return false unless self.send(name) == other.send(name)
       end
       true
     end
+
     private :same_attributes?
 
     def hash # :nodoc:
@@ -779,8 +667,6 @@ module Gem
       }
     end
 
-    # Export methods (YAML and Ruby code) ----------------------------
-
     def to_yaml(opts = {}) # :nodoc:
       mark_version
 
@@ -861,7 +747,7 @@ module Gem
       result << "    s.specification_version = #{specification_version}"
       result << nil
 
-      result << "    if current_version >= 3 then"
+      result << "    if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then"
 
       unless dependencies.empty? then
         dependencies.each do |dep|
@@ -895,16 +781,15 @@ module Gem
       result.join "\n"
     end
 
-    # Validation and normalization methods ---------------------------
-
-    # Checks that the specification contains all required fields, and
-    # does a very basic sanity check.
+    ##
+    # Checks that the specification contains all required fields, and does a
+    # very basic sanity check.
     #
-    # Raises InvalidSpecificationException if the spec does not pass
-    # the checks..
+    # Raises InvalidSpecificationException if the spec does not pass the
+    # checks..
+
     def validate
       extend Gem::UserInteraction
-
       normalize
 
       if rubygems_version != RubyGemsVersion then
@@ -959,13 +844,14 @@ module Gem
       true
     end
 
+    ##
     # Normalize the list of files so that:
     # * All file lists have redundancies removed.
-    # * Files referenced in the extra_rdoc_files are included in the
-    #   package file list. 
+    # * Files referenced in the extra_rdoc_files are included in the package
+    #   file list. 
     #
-    # Also, the summary and description are converted to a normal
-    # format. 
+    # Also, the summary and description are converted to a normal format. 
+
     def normalize
       if defined?(@extra_rdoc_files) and @extra_rdoc_files then
         @extra_rdoc_files.uniq!
@@ -975,15 +861,12 @@ module Gem
       @files.uniq! if @files
     end
 
-    # Dependency methods ---------------------------------------------
-    
-    # Return a list of all gems that have a dependency on this
-    # gemspec.  The list is structured with entries that conform to:
+    ##
+    # Return a list of all gems that have a dependency on this gemspec.  The
+    # list is structured with entries that conform to:
     #
     #   [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]
-    #
-    # return:: [Array] [[dependent_gem, dependency, [list_of_satisfiers]]]
-    #
+
     def dependent_gems
       out = []
       Gem.source_index.each do |name,gem|
@@ -1004,8 +887,6 @@ module Gem
       "#<Gem::Specification name=#{@name} version=#{@version}>"
     end
 
-    private
-
     def add_dependency_with_type(dependency, type, *requirements)
       requirements = if requirements.empty? then
                        Gem::Requirement.default
@@ -1022,6 +903,8 @@ module Gem
       dependencies << dependency
     end
 
+    private :add_dependency_with_type
+
     def find_all_satisfiers(dep)
       Gem.source_index.each do |name,gem|
         if(gem.satisfies_requirement?(dep)) then
@@ -1030,8 +913,12 @@ module Gem
       end
     end
 
-    # Return a string containing a Ruby code representation of the
-    # given object.
+    private :find_all_satisfiers
+
+    ##
+    # Return a string containing a Ruby code representation of the given
+    # object.
+
     def ruby_code(obj)
       case obj
       when String            then '%q{' + obj + '}'
@@ -1046,6 +933,326 @@ module Gem
       else raise Exception, "ruby_code case not handled: #{obj.class}"
       end
     end
+    
+    private :ruby_code
+
+    # :section: Required gemspec attributes
+    
+    ##
+    # The version of RubyGems used to create this gem
+
+    required_attribute :rubygems_version, Gem::RubyGemsVersion
+
+    ##
+    # The Gem::Specification version of this gemspec
+
+    required_attribute :specification_version, CURRENT_SPECIFICATION_VERSION
+
+    ##
+    # This gem's name
+
+    required_attribute :name
+
+    ##
+    # This gem's version
+
+    required_attribute :version
+
+    ##
+    # The date this gem was created
+
+    required_attribute :date, TODAY
+
+    ##
+    # A short summary of this gem's description.  Displayed in `gem list -d`.
+
+    required_attribute :summary
+
+    ##
+    # Paths in the gem to add to $LOAD_PATH when this gem is activated
+
+    required_attribute :require_paths, ['lib']
+
+    # :section: Optional gemspec attributes
+
+    ##
+    # A contact email for this gem
+    
+    attribute :email
+
+    ##
+    # The URL of this gem's home page
+
+    attribute :homepage
+
+    ##
+    # The rubyforge project this gem lives under.  i.e. RubyGems'
+    # rubyforge_project is "rubygems".
+    
+    attribute :rubyforge_project
+
+    ##
+    # A long description of this gem
+
+    attribute :description
+
+    ##
+    # Autorequire was used by old RubyGems to automatically require a file.
+    # It no longer is supported.
+
+    attribute :autorequire
+
+    ##
+    # The default executable for this gem.
+
+    attribute :default_executable
+
+    ##
+    # The path in the gem for executable scripts
+
+    attribute :bindir, 'bin'
+
+    ##
+    # True if this gem is RDoc-compliant
+
+    attribute :has_rdoc, false
+
+    ##
+    # True if this gem supports RDoc
+
+    alias :has_rdoc? :has_rdoc
+
+    ##
+    # The ruby of version required by this gem
+
+    attribute :required_ruby_version, Gem::Requirement.default
+
+    ##
+    # The RubyGems version required by this gem
+
+    attribute :required_rubygems_version, Gem::Requirement.default
+
+    ##
+    # The platform this gem runs on.  See Gem::Platform for details.
+
+    attribute :platform, Gem::Platform::RUBY
+
+    ##
+    # The key used to sign this gem.  See Gem::Security for details.
+
+    attribute :signing_key, nil
+
+    ##
+    # The certificate chain used to sign this gem.  See Gem::Security for
+    # details.
+
+    attribute :cert_chain, []
+
+    ##
+    # A message that gets displayed after the gem is installed
+
+    attribute :post_install_message, nil
+
+    ##
+    # The list of authors who wrote this gem
+
+    array_attribute :authors
+
+    ##
+    # Files included in this gem
+
+    array_attribute :files
+
+    ##
+    # Test files included in this gem
+
+    array_attribute :test_files
+
+    ##
+    # An ARGV-style array of options to RDoc
+
+    array_attribute :rdoc_options
+
+    ##
+    # Extra files to add to RDoc
+
+    array_attribute :extra_rdoc_files
+
+    ##
+    # Executables included in the gem
+
+    array_attribute :executables
+
+    ##
+    # Extensions to build when installing the gem.  See
+    # Gem::Installer#build_extensions for valid values.
+
+    array_attribute :extensions
+
+    ##
+    # An array or things required by this gem.  Not used by anything
+    # presently.
+
+    array_attribute :requirements
+
+    ##
+    # A list of Gem::Dependency objects this gem depends on.  Only appendable.
+
+    array_attribute :dependencies
+
+    read_only :dependencies
+
+    # :section: Aliased gemspec attributes
+
+    ##
+    # Singular accessor for executables
+    
+    attribute_alias_singular :executable, :executables
+
+    ##
+    # Singular accessor for authors
+
+    attribute_alias_singular :author, :authors
+
+    ##
+    # Singular accessor for require_paths
+
+    attribute_alias_singular :require_path, :require_paths
+
+    ##
+    # Singular accessor for test_files
+
+    attribute_alias_singular :test_file, :test_files
+
+    overwrite_accessor :version= do |version|
+      @version = Version.create(version)
+    end
+
+    overwrite_accessor :platform do
+      @new_platform
+    end
+
+    overwrite_accessor :platform= do |platform|
+      if @original_platform.nil? or
+         @original_platform == Gem::Platform::RUBY then
+        @original_platform = platform
+      end
+
+      case platform
+      when Gem::Platform::CURRENT then
+        @new_platform = Gem::Platform.local
+        @original_platform = @new_platform.to_s
+
+      when Gem::Platform then
+        @new_platform = platform
+
+      # legacy constants
+      when nil, Gem::Platform::RUBY then
+        @new_platform = Gem::Platform::RUBY
+      when 'mswin32' then # was Gem::Platform::WIN32
+        @new_platform = Gem::Platform.new 'x86-mswin32'
+      when 'i586-linux' then # was Gem::Platform::LINUX_586
+        @new_platform = Gem::Platform.new 'x86-linux'
+      when 'powerpc-darwin' then # was Gem::Platform::DARWIN
+        @new_platform = Gem::Platform.new 'ppc-darwin'
+      else
+        @new_platform = Gem::Platform.new platform
+      end
+
+      @platform = @new_platform.to_s
+
+      @new_platform
+    end
+
+    overwrite_accessor :required_ruby_version= do |value|
+      @required_ruby_version = Gem::Requirement.create(value)
+    end
+
+    overwrite_accessor :required_rubygems_version= do |value|
+      @required_rubygems_version = Gem::Requirement.create(value)
+    end
+
+    overwrite_accessor :date= do |date|
+      # We want to end up with a Time object with one-day resolution.
+      # This is the cleanest, most-readable, faster-than-using-Date
+      # way to do it.
+      case date
+      when String then
+        @date = if /\A(\d{4})-(\d{2})-(\d{2})\Z/ =~ date then
+                  Time.local($1.to_i, $2.to_i, $3.to_i)
+                else
+                  require 'time'
+                  Time.parse date
+                end
+      when Time then
+        @date = Time.local(date.year, date.month, date.day)
+      when Date then
+        @date = Time.local(date.year, date.month, date.day)
+      else
+        @date = TODAY
+      end
+    end
+
+    overwrite_accessor :date do
+      self.date = nil if @date.nil?  # HACK Sets the default value for date
+      @date
+    end
+
+    overwrite_accessor :summary= do |str|
+      @summary = if str then
+                   str.strip.
+                   gsub(/(\w-)\n[ \t]*(\w)/, '\1\2').
+                   gsub(/\n[ \t]*/, " ")
+                 end
+    end
+
+    overwrite_accessor :description= do |str|
+      @description = if str then
+                       str.strip.
+                       gsub(/(\w-)\n[ \t]*(\w)/, '\1\2').
+                       gsub(/\n[ \t]*/, " ")
+                     end
+    end
+
+    overwrite_accessor :default_executable do
+      begin
+        if defined?(@default_executable) and @default_executable
+          result = @default_executable
+        elsif @executables and @executables.size == 1
+          result = Array(@executables).first
+        else
+          result = nil
+        end
+        result
+      rescue
+        nil
+      end
+    end
+
+    overwrite_accessor :test_files do
+      # Handle the possibility that we have @test_suite_file but not
+      # @test_files.  This will happen when an old gem is loaded via
+      # YAML.
+      if defined? @test_suite_file then
+        @test_files = [@test_suite_file].flatten
+        @test_suite_file = nil
+      end
+      if defined?(@test_files) and @test_files then
+        @test_files
+      else
+        @test_files = []
+      end
+    end
+
+    overwrite_accessor :files do
+      result = []
+      result.push(*@files) if defined?(@files)
+      result.push(*@test_files) if defined?(@test_files)
+      result.push(*(add_bindir(@executables)))
+      result.push(*@extra_rdoc_files) if defined?(@extra_rdoc_files)
+      result.push(*@extensions) if defined?(@extensions)
+      result.uniq.compact
+    end
 
   end
 
diff -pruN 1.2.0-2/lib/rubygems/test_utilities.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/test_utilities.rb
--- 1.2.0-2/lib/rubygems/test_utilities.rb	2008-05-29 00:46:15.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/test_utilities.rb	2008-08-27 17:30:06.000000000 +0100
@@ -30,29 +30,40 @@ class Gem::FakeFetcher
     @paths = []
   end
 
-  def fetch_path(path)
+  def fetch_path path, mtime = nil
     path = path.to_s
     @paths << path
     raise ArgumentError, 'need full URI' unless path =~ %r'^http://'
-    data = @data[path]
 
-    if data.nil? then
-      raise Gem::RemoteFetcher::FetchError.new('no data', path)
+    unless @data.key? path then
+      raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
     end
 
-    data.respond_to?(:call) ? data.call : data
+    data = @data[path]
+
+    if data.respond_to?(:call) then
+      data.call
+    else
+      if path.to_s =~ /gz$/ and not data.nil? and not data.empty? then
+        data = Gem.gunzip data
+      end
+
+      data
+    end
   end
 
   def fetch_size(path)
     path = path.to_s
     @paths << path
+
     raise ArgumentError, 'need full URI' unless path =~ %r'^http://'
-    data = @data[path]
 
-    if data.nil? then
-      raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", nil)
+    unless @data.key? path then
+      raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
     end
 
+    data = @data[path]
+
     data.respond_to?(:call) ? data.call : data.length
   end
 
diff -pruN 1.2.0-2/lib/rubygems/uninstaller.rb 1.3.0~RC1-0ubuntu1/lib/rubygems/uninstaller.rb
--- 1.2.0-2/lib/rubygems/uninstaller.rb	2008-06-20 19:34:46.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems/uninstaller.rb	2008-08-27 17:30:06.000000000 +0100
@@ -18,9 +18,23 @@ class Gem::Uninstaller
   include Gem::UserInteraction
 
   ##
-  # Constructs an Uninstaller instance
-  #
-  # gem:: [String] The Gem name to uninstall
+  # The directory a gem's executables will be installed into
+
+  attr_reader :bin_dir
+
+  ##
+  # The gem repository the gem will be installed into
+
+  attr_reader :gem_home
+
+  ##
+  # The Gem::Specification for the gem being uninstalled, only set during
+  # #uninstall_gem
+
+  attr_reader :spec
+
+  ##
+  # Constructs an uninstaller that will uninstall +gem+
 
   def initialize(gem, options = {})
     @gem = gem
@@ -31,42 +45,63 @@ class Gem::Uninstaller
     @force_all = options[:all]
     @force_ignore = options[:ignore]
     @bin_dir = options[:bin_dir]
+
+    spec_dir = File.join @gem_home, 'specifications'
+    @source_index = Gem::SourceIndex.from_gems_in spec_dir
   end
 
   ##
-  # Performs the uninstall of the Gem.  This removes the spec, the
-  # Gem directory, and the cached .gem file,
+  # Performs the uninstall of the gem.  This removes the spec, the Gem
+  # directory, and the cached .gem file.
 
   def uninstall
-    list = Gem.source_index.search(/^#{@gem}$/, @version)
+    list = @source_index.find_name @gem, @version
 
     if list.empty? then
       raise Gem::InstallError, "Unknown gem #{@gem} #{@version}"
-    elsif list.size > 1 && @force_all
-      remove_all(list.dup)
-      remove_executables(list.last)
-    elsif list.size > 1
-      say
+
+    elsif list.size > 1 and @force_all then
+      remove_all list.dup
+
+    elsif list.size > 1 then
       gem_names = list.collect {|gem| gem.full_name} + ["All versions"]
-      gem_name, index =
-        choose_from_list("Select gem to uninstall:", gem_names)
-      if index == list.size
-        remove_all(list.dup)
-        remove_executables(list.last)
-      elsif index >= 0 && index < list.size
-        to_remove = list[index]
-        remove(to_remove, list)
-        remove_executables(to_remove)
+
+      say
+      gem_name, index = choose_from_list "Select gem to uninstall:", gem_names
+
+      if index == list.size then
+        remove_all list.dup
+      elsif index >= 0 && index < list.size then
+        uninstall_gem list[index], list.dup
       else
         say "Error: must enter a number [1-#{list.size+1}]"
       end
     else
-      remove(list[0], list.dup)
-      remove_executables(list.last)
+      uninstall_gem list.first, list.dup
     end
   end
 
   ##
+  # Uninstalls gem +spec+
+
+  def uninstall_gem(spec, specs)
+    @spec = spec
+
+    Gem.pre_uninstall_hooks.each do |hook|
+      hook.call self
+    end
+
+    specs.each { |s| remove_executables s }
+    remove spec, specs
+
+    Gem.post_uninstall_hooks.each do |hook|
+      hook.call self
+    end
+
+    @spec = nil
+  end
+
+  ##
   # Removes installed executables and batch files (windows only) for
   # +gemspec+.
 
@@ -76,7 +111,7 @@ class Gem::Uninstaller
     if gemspec.executables.size > 0 then
       bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home)
 
-      list = Gem.source_index.search(gemspec.name).delete_if { |spec|
+      list = @source_index.find_name(gemspec.name).delete_if { |spec|
         spec.version == gemspec.version
       }
 
@@ -118,7 +153,7 @@ class Gem::Uninstaller
   # NOTE: removes uninstalled gems from +list+.
 
   def remove_all(list)
-    list.dup.each { |spec| remove spec, list }
+    list.dup.each { |spec| uninstall_gem spec, list }
   end
 
   ##
@@ -185,8 +220,7 @@ class Gem::Uninstaller
   def dependencies_ok?(spec)
     return true if @force_ignore
 
-    source_index = Gem::SourceIndex.from_installed_gems
-    deplist = Gem::DependencyList.from_source_index source_index
+    deplist = Gem::DependencyList.from_source_index @source_index
     deplist.ok_to_remove?(spec.full_name) || ask_if_ok(spec)
   end
 
diff -pruN 1.2.0-2/lib/rubygems.rb 1.3.0~RC1-0ubuntu1/lib/rubygems.rb
--- 1.2.0-2/lib/rubygems.rb	2008-06-20 20:54:57.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/lib/rubygems.rb	2008-08-27 17:30:06.000000000 +0100
@@ -104,6 +104,11 @@ module Gem
   @ruby = nil
   @sources = []
 
+  @post_install_hooks = []
+  @post_uninstall_hooks = []
+  @pre_uninstall_hooks = []
+  @pre_install_hooks = []
+
   ##
   # Activates an installed gem matching +gem+.  The gem must satisfy
   # +version_requirements+.
@@ -337,6 +342,22 @@ module Gem
   end
 
   ##
+  # Returns a list of paths matching +file+ that can be used by a gem to pick
+  # up features from other gems.  For example:
+  #
+  #   Gem.find_files('rdoc/discover').each do |path| load path end
+  #
+  # find_files does not search $LOAD_PATH for files, only gems.
+
+  def self.find_files(path)
+    specs = searcher.find_all path
+
+    specs.map do |spec|
+      searcher.matching_files spec, path
+    end.flatten
+  end
+
+  ##
   # Finds the user's home directory.
   #--
   # Some comments from the ruby-talk list regarding finding the home
@@ -353,7 +374,7 @@ module Gem
     end
 
     if ENV['HOMEDRIVE'] && ENV['HOMEPATH'] then
-      return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
+      return "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}"
     end
 
     begin
@@ -524,6 +545,40 @@ module Gem
   end
 
   ##
+  # Adds a post-install hook that will be passed an Gem::Installer instance
+  # when Gem::Installer#install is called
+
+  def self.post_install(&hook)
+    @post_install_hooks << hook
+  end
+
+  ##
+  # Adds a post-uninstall hook that will be passed a Gem::Uninstaller instance
+  # and the spec that was uninstalled when Gem::Uninstaller#uninstall is
+  # called
+
+  def self.post_uninstall(&hook)
+    @post_uninstall_hooks << hook
+  end
+
+  ##
+  # Adds a pre-install hook that will be passed an Gem::Installer instance
+  # when Gem::Installer#install is called
+
+  def self.pre_install(&hook)
+    @pre_install_hooks << hook
+  end
+
+  ##
+  # Adds a pre-uninstall hook that will be passed an Gem::Uninstaller instance
+  # and the spec that will be uninstalled when Gem::Uninstaller#uninstall is
+  # called
+
+  def self.pre_uninstall(&hook)
+    @pre_uninstall_hooks << hook
+  end
+
+  ##
   # The directory prefix this RubyGems was installed at.
 
   def self.prefix
@@ -600,6 +655,9 @@ module Gem
       @ruby = File.join(ConfigMap[:bindir],
                         ConfigMap[:ruby_install_name])
       @ruby << ConfigMap[:EXEEXT]
+
+      # escape string in case path to ruby executable contain spaces.
+      @ruby.sub!(/.*\s.*/m, '"\&"')
     end
 
     @ruby
@@ -650,6 +708,7 @@ module Gem
 
       @gem_path << Gem.dir
     else
+      # TODO: should this be Gem.default_path instead?
       @gem_path = [Gem.dir]
     end
 
@@ -730,6 +789,27 @@ module Gem
 
     attr_reader :loaded_specs
 
+    ##
+    # The list of hooks to be run before Gem::Install#install does any work
+
+    attr_reader :post_install_hooks
+
+    ##
+    # The list of hooks to be run before Gem::Uninstall#uninstall does any
+    # work
+
+    attr_reader :post_uninstall_hooks
+
+    ##
+    # The list of hooks to be run after Gem::Install#install is finished
+
+    attr_reader :pre_install_hooks
+
+    ##
+    # The list of hooks to be run after Gem::Uninstall#uninstall is finished
+
+    attr_reader :pre_uninstall_hooks
+
     # :stopdoc:
 
     alias cache source_index # an alias for the old name
diff -pruN 1.2.0-2/Rakefile 1.3.0~RC1-0ubuntu1/Rakefile
--- 1.2.0-2/Rakefile	2008-06-22 02:57:18.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/Rakefile	2008-08-27 17:30:06.000000000 +0100
@@ -337,7 +337,8 @@ end
 
 desc "Install RubyGems"
 task :install do
-  ruby 'setup.rb'
+  opts = ENV['SETUP_OPTIONS']
+  ruby "setup.rb #{opts}".strip
 
   svnversion = `svnversion`.split(':').last.sub(/[^\d]/, '').strip
 
diff -pruN 1.2.0-2/redist/session.gem 1.3.0~RC1-0ubuntu1/redist/session.gem
--- 1.2.0-2/redist/session.gem	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/redist/session.gem	2008-08-27 17:30:05.000000000 +0100
@@ -0,0 +1,433 @@
+        MD5SUM = "5f77e34208c02ef0f51a973ec1ae375e"
+        if $0 == __FILE__
+          require 'optparse'
+        
+          options = {}
+          ARGV.options do |opts|
+            opts.on_tail("--help", "show this message") {puts opts; exit}
+            opts.on('--dir=DIRNAME', "Installation directory for the Gem") {|options[:directory]|}
+            opts.on('--force', "Force Gem to intall, bypassing dependency checks") {|options[:force]|}
+            opts.on('--gen-rdoc', "Generate RDoc documentation for the Gem") {|options[:gen_rdoc]|}
+            opts.parse!
+          end
+
+          require 'rubygems'
+          @directory = options[:directory] || Gem.dir  
+          @force = options[:force]
+  
+          gem = Gem::Installer.new(__FILE__).install(@force, @directory)      
+          if options[:gen_rdoc]
+            Gem::DocManager.new(gem).generate_rdoc
+          end
+end
+
+__END__
+--- !ruby/object:Gem::Specification 
+rubygems_version: "1.0"
+name: session
+version: !ruby/object:Gem::Version 
+  version: 2.1.6
+date: 2004-04-04 10:52:12.946674 -04:00
+platform: ruby
+summary: Session::* offers a set of class for driving external progams via pipes.  It offers a significant abstraction over Open3::popen since stdout/stderr can be processed individually for each command.  Additionally the exit_status of each command is made available.
+require_paths: 
+  - lib
+files: 
+  - test/session.rb
+  - lib/session-2.1.6.rb
+  - lib/session.rb
+  - sample/bash.rb
+  - sample/bash.rb.out
+  - sample/driver.rb
+  - sample/session_idl.rb
+  - sample/session_sh.rb
+  - sample/sh0.rb
+  - sample/threadtest.rb
+  - README
+  - HISTORY
+  - TODO
+autorequire: session
+author: Ara T. Howard
+email: ara.t.howard at noaa.gov
+homepage: http://www.codeforpeople.com/lib/ruby/session/
+test_suite_file: test/session.rb
+--- 
+- 
+  size: 5782
+  mode: 420
+  path: test/session.rb
+- 
+  size: 15363
+  mode: 493
+  path: lib/session-2.1.6.rb
+- 
+  size: 15363
+  mode: 493
+  path: lib/session.rb
+- 
+  size: 1253
+  mode: 493
+  path: sample/bash.rb
+- 
+  size: 667
+  mode: 420
+  path: sample/bash.rb.out
+- 
+  size: 831
+  mode: 420
+  path: sample/driver.rb
+- 
+  size: 521
+  mode: 420
+  path: sample/session_idl.rb
+- 
+  size: 588
+  mode: 420
+  path: sample/session_sh.rb
+- 
+  size: 538
+  mode: 420
+  path: sample/sh0.rb
+- 
+  size: 640
+  mode: 420
+  path: sample/threadtest.rb
+- 
+  size: 884
+  mode: 420
+  path: README
+- 
+  size: 1300
+  mode: 420
+  path: HISTORY
+- 
+  size: 154
+  mode: 420
+  path: TODO
+---
+eJzNGGtv2zbwu37FVU4re3WUOM26zo4drKvRBRiaLU76pQkCWqIjLrKoidRc
+w/F/35F6W7bzWIpVQGLyeHe8N3l8OWv6bAy2vad/cNCyKXG8xZ17BztdOw6E
+xyYS3KUR0b9jFlGwBBWC8cAydj4Pz96fjob9gPnG6PzD6cW5LeaBA32QUUwV
+aHh2tgpSWGEsBZijhFG3i3xGJ6ef4KixgBpwOTDXktmxoNciJLOgTFeCHoOl
+9rSgC9aE+AJHipfRAAKSTSmPJUyp9LgLM485HricCgi4BCF5CMT3QXoRJa54
+YTg+EQLOE6phFPEIjmAkSeCSyNXzHtDANVw6yXkHRmOxWBgAEZWovzISgMNc
+HE94dAs4iwMfxVZAnACaiIRNa3Ty8c+Lk3OrtQD6lckXsNSLwqc0RKZqPKY3
+LOjBHxF3kN6+ZSirorsYnXWsdg4PQ+b2cHvhxBRQyoB3u8OvDg0lWkoLDJqd
+3gZHFI1U8NcjAA+V9GmkPZiKp7dpLdA6fAbdVN92xTx2QGfLlIPGC5CBQ6Tj
+NTMC1C+xzJxR34UMm02qdu73+ymHFAHAZSL0yTyfY3icfLJvqBQ5KCJM0Cqd
+8k/yK+KIpsBNltQeaCvPFAZ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
+ZP4ABEa5Wg==
+---
+eJwtzDEOwjAMBdCdU/ytCxU7M3sXdpQmNkTENspPJXp7BGJ627sul+WMAzBD
+Ux7REduA9H76ajIeUQjtYaB4ueUwS17AALc1t0SiEkwq/bcUGdKtusDDZ+4c
+YsiptX+GUJSofsdkT60a0xGvIOvadmTIe4izhh8+Aqs19w==
diff -pruN 1.2.0-2/scripts/gemdoc.data 1.3.0~RC1-0ubuntu1/scripts/gemdoc.data
--- 1.2.0-2/scripts/gemdoc.data	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/scripts/gemdoc.data	2008-08-27 17:30:05.000000000 +0100
@@ -0,0 +1,617 @@
+== gem build -- Build a gem file from a specification
+
+The build command is used by developers to package their Ruby software
+into a single gem file that can be distributed.  The build command
+requires a gemspec file to describe the metadata in the packge.  You
+can see a good example of using build in CreateAGemInTenMinutes.
+
+A yaml file containing the Gem::Specification object built by a
+gemspec (instead of a gemspec file) may also be also be used with the
+build command.
+
+h3. Usage
+
+!usage build
+
+h3. Examples
+
+This example builds a the rake package from a gemspec file.
+
+<pre>
+$ gem build rake.gemspec 
+Attempting to build gem spec 'rake.gemspec'
+  Successfully built RubyGem
+  Name: rake
+  Version: 0.4.0
+  File: rake-0.4.0.gem
+</pre>
+
+Of course, rake isn't normally built from a gemspec.  It uses a
+special gem building task to build the gem directly from the rakefile.
+See CreateAGemUsingRake for more details.
+
+<pre>
+$ rake gem
+(in /home/jim/working/rubyforge/rake)
+  Successfully built RubyGem
+  Name: rake
+  Version: 0.4.0
+  File: rake-0.4.0.gem
+</pre>
+
+
+<hr/>
+
+== gem cert -- Support signing and managing signed gems
+
+The cert command manages the certificates needed to sign gems.
+
+h3. Usage
+
+!usage cert
+
+See the "chapter on signing
+gems":http://docs.rubygems.org/read/chapter/21 in the :Ruby Users
+Guide":http://docs.rubygems.org/read/book/1 for details.
+
+h3. Examples
+
+Build a private key and certificate for gemmaster at example.com.
+Substitute your own email address for your own certificates.
+
+<pre>$ gem cert --build gemmaster at example.com</pre>
+
+Add a certificate to the list of trusted certificates.  The trusted
+certificate list will be consulted when installing signed gems.
+
+<pre>$ gem cert --add gem-public_cert.pem</pre>
+
+Sign a certificate with the specified key and certificate (note that
+this modifies client_cert.pem!)
+
+<pre>
+$ gem cert \
+     -K /mnt/floppy/issuer-priv_key.pem \
+     -C issuer-pub_cert.pem \
+     --sign client_cert.pem
+</pre>
+
+<hr/>
+
+== gem check -- Check installed gems for problems
+
+The check command is used to verify that a gem in is good working order.
+
+h3. Usage
+
+!usage check
+
+The <em>verify</em> option checks a gem file for corruption.  If the file is
+not exactly like it was built, verify will complain.  (Note: This is a
+simple integrity check.  It is not checking for PGP like signatures).
+
+The <em>alien</em> option checks an installed gem to see if any of the files
+have been tampered with.
+
+h3. Examples
+
+The following check is run against a valid rake gem file.
+
+<pre>
+$ gem check -v pkg/rake-0.4.0.gem 
+Verifying gem: 'pkg/rake-0.4.0.gem'
+</pre>
+
+The following check shows that the rake gem file is invalid.
+
+<pre>
+$ gem check -v pkg/rake-0.4.0.gem
+Verifying gem: 'pkg/rake-0.4.0.gem'
+ERROR:  pkg/rake-0.4.0.gem is invalid.
+</pre>
+
+In this installation of <nowiki>ActiveRecord</nowiki>, the postgreSQL driver
+has been locally patched after the gem was installed.  This is how the alien
+option reports it.
+
+<pre>
+$ gem check --alien
+Performing the 'alien' operation
+madeleine-0.6 is error-free
+
+madeleine-0.6.1 is error-free
+
+rake-0.4.0 is error-free
+
+rake-0.3.2 is error-free
+
+copland-0.3.0 is error-free
+
+sources-0.0.1 has 2 problems
+
+iterator-0.5 is error-free
+
+activerecord-0.8.1 has 2 problems
+	lib/active_record/connection_adapters/postgresql_adapter.rb:
+	installed file doesn't match original from gem
+
+	/usr/local/lib/ruby/gems/1.8/cache/activerecord-0.8.1.gem:
+	Unmanaged files in gem: ["lib/active_record/connection_adapters/postgresql_adapter.rb~"]
+
+
+[... remaining output elided ...]
+</pre>
+
+<hr/>
+
+== gem cleanup [gemname] -- Cleanup the outdated versions
+
+(new in version 0.8.7)
+
+This command will remove (uninstall) all the versions of a gem, except
+for the latest one.  If no gemname is given in the command line, cleanup will be run agains all installed gems.
+
+h3. Usage
+
+!usage cleanup
+
+h3. Examples
+
+<pre>
+$ gem cleanup
+Rubygems Environment:
+  - VERSION: 0.6 (0.6.1)
+  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
+  - GEM PATH:
+     - /usr/local/lib/ruby/gems/1.8
+  - REMOTE SOURCES:
+     - http://gems.rubyforge.org
+</pre>
+
+<hr/>
+
+== gem contents [installed_gemname] -- List the file contents of the installed gem.
+
+(new in version 0.8.11)
+
+The @contents@ command will list the full path names of all the files
+contained in the gem.
+
+h3. Usage
+
+!usage contents
+
+h3. Examples
+
+The following command displays the files included in the Rake gem.
+
+<pre>
+$ gem contents rake
+traken$ gem inspect rake
+/usr/local/lib/ruby/gems/1.8/gems/rake-0.5.4.3/install.rb
+/usr/local/lib/ruby/gems/1.8/gems/rake-0.5.4.3/CHANGES
+/usr/local/lib/ruby/gems/1.8/gems/rake-0.5.4.3/Rakefile
+/usr/local/lib/ruby/gems/1.8/gems/rake-0.5.4.3/README
+/usr/local/lib/ruby/gems/1.8/gems/rake-0.5.4.3/TODO
+[... truncated ...]
+</pre>
+
+h3. Limitations
+
+Currently there is no way to specify the version of the gem you wish
+to view.
+
+<hr/>
+
+== gem dependency -- List the dependencies of a gem
+
+The @dependency@ command displays the declared dependencies of any install gem package.
+
+h3. Usage
+
+!usage dependency
+
+h3. Examples
+
+Here is the dependencies of the Rails gem.
+
+<pre>
+$ gem dependency rails -v 0.10.1
+Gem rails-0.10.1
+  Requires
+    rake (>= 0.4.15)
+    activesupport (= 1.0.1)
+    activerecord (= 1.8.0)
+    actionpack (= 1.5.1)
+    actionmailer (= 0.7.1)
+    actionwebservice (= 0.6.0)
+
+</pre>
+
+Adding a @--reverse-dependencies@ option adds the following bit of information:
+
+<pre>
+$ gem dependency rails -v 0.10.1 --reverse-dependencies
+Gem rails-0.10.1
+  Requires
+    rake (>= 0.4.15)
+    activesupport (= 1.0.1)
+    activerecord (= 1.8.0)
+    actionpack (= 1.5.1)
+    actionmailer (= 0.7.1)
+    actionwebservice (= 0.6.0)
+  Used by
+    storycards-0.0.2 (rails (>= 0.7.0))
+</pre>
+
+Finally, the @--pipe@ option for the dependency command puts out the dependencies in a format that could be piped to another command.
+
+<pre>
+$ gem dependency rails -v 0.10.1 --pipe
+rake --version '>= 0.4.15'
+activesupport --version '= 1.0.1'
+activerecord --version '= 1.8.0'
+actionpack --version '= 1.5.1'
+actionmailer --version '= 0.7.1'
+actionwebservice --version '= 0.6.0'
+</pre>
+
+<hr/>
+
+== gem environment -- Display information about the gem environment
+
+Gems uses several paths and directories to perform its work.  This
+command will display the information the gem command has found.
+
+h3. Usage
+
+!usage environment
+
+h3. Examples
+
+<pre>
+$ gem environment
+Rubygems Environment:
+  - VERSION: 0.6 (0.6.1)
+  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
+  - GEM PATH:
+     - /usr/local/lib/ruby/gems/1.8
+  - REMOTE SOURCES:
+     - http://gems.rubyforge.org
+</pre>
+
+<hr/>
+
+== gem help -- Provide help about gem commands
+
+<tt>gem help</tt> provides information about the syntax and options
+available on the gem command.
+
+h3. Usage
+
+!usage help
+
+<hr/>
+
+== gem install -- Installing a gem
+
+<tt>gem install</tt> will install the named gem. It will
+attempt a local installation (i.e. a .gem file in the current
+directory), and if that fails, it will attempt to download and install
+the most recent version of the gem you want.
+
+If a gem is being installed remotely, and it depends on other gems
+that are not installed, then gem will download and install those,
+after you have confirmed the operation.
+
+h3. Usage
+
+!usage install
+
+h3. Examples
+
+These examples show how GEMNAME can be specified:
+
+This will install local 'copland.gem' or remote 'copland-0.3.0' (for
+instance), but not a local file 'copland-0.3.0' gem.
+
+  gem install copland               
+
+This will install local 'copland-0.2.0' or remote 'copland-0.2.0'.
+
+  gem install copland-0.2.0
+
+This will only succeed if the local file exists. This will not resolve to a remote gem.
+
+  gem install copland-0.2.0.gem
+
+<pre>
+  gem install --remote copland         # shortcut: gem ins -R copland
+  gem install copland --version '> 0.2'
+  gem install copland --gen-rdoc --run-tests
+  gem install copland --install-stub
+</pre>
+
+Here is an example session where a dependency is automatically
+downloaded and resolved.
+
+<pre>
+$ gem install copland
+Attempting local installation of ''
+Local gem file not found: copland.gem
+Attempting remote installation of 'copland'
+Install required dependency log4r? [Yn]   y
+Successfully installed copland, version 0.3.0
+</pre>
+
+<hr/>
+
+== gem list -- List gems starting with a string
+
+<tt>gem list</tt> will list all gems whose name <em>starts with</em> the given
+string.  If no string is provided, all gems are listed.
+
+h3. Usage
+
+!usage list
+
+h3. Examples
+
+List all remote gems starting with "a".
+
+<pre>
+$ gem list -r a
+
+*** REMOTE GEMS ***
+
+activerecord (0.8.4, 0.8.3, 0.8.2, 0.8.1, 0.8.0, 0.7.6, 0.7.5)
+    Implements the ActiveRecord pattern for ORM.
+
+arrayfields (3.3.0)
+    Allow keyword access to arrays
+</pre>
+
+List all gems, local and remote.
+
+<pre>
+$ gem list --both
+
+*** LOCAL GEMS ***
+
+  ...
+
+*** REMOTE GEMS ***
+
+  ...
+</pre>
+
+<hr/>
+
+== gem query -- Query for a list of gems
+
+<tt>gem query</tt> will list all gems matching a particular criteria.
+The domain may be local, remote or both.
+
+h3. Usage
+
+!usage query
+
+h3. Examples
+
+To list all local gems with a digit in the gem name:
+
+<pre>
+$ gem query -n '[0-9]' --local
+
+*** LOCAL GEMS ***
+
+jabber4r (0.7.0)
+    Jabber4r is a pure-Ruby Jabber client library
+
+log4r (1.0.5)
+    Log4r is a comprehensive and flexible logging library for Ruby.
+</pre>
+
+To list all remote gems that begin with the letter 'm':
+
+<pre>
+$ gem query -R -n ^m
+
+*** REMOTE GEMS ***
+
+madeleine (0.6.1, 0.6)
+    Madeleine is a Ruby implementation of Object Prevalence
+
+midilib (0.8.0)
+    MIDI file and event manipulation library
+</pre>
+
+<hr/>
+
+== gem rdoc -- Generate the RDoc files for an installed gem
+
+<tt>gem rdoc</tt> will generate the RDoc files for an installed gem.
+The files are put in the standard gem RDoc location so that
+ at gem_server@ can find them.
+
+h3. Usage
+
+!usage rdoc
+
+h3. Examples
+
+The following command generates the RDoc files for the rake-0.5.4 gem.  
+
+<pre>
+traken$ sudo gem rdoc rake --version 0.5.4
+Installing RDoc documentation for rake-0.5.4...
+</pre>
+
+<hr/>
+
+== gem search -- List gems containing a string
+
+<tt>gem search</tt> will list all gems whose name <em>contains</em> the given
+(case-insensitive) string.  If no string is provided, all gems will be listed.
+
+h3. Usage
+
+!usage search
+
+h3. Examples
+
+List all remote gems containing "log" in their name.
+
+<pre>
+$ gem search -r log
+
+*** REMOTE GEMS ***
+
+log4r (1.0.5)
+    Log4r is a comprehensive and flexible logging library for Ruby.
+
+rublog (0.8.0)
+    RubLog is a simple web log, based around the idea of displaying a
+    set of regular files in a log-format.
+</pre>
+
+<hr/>
+
+== gem specification -- Extract the Gem::Specification from a gem file
+
+The specification command will extract the Gem::Specification from a
+gem file and write to standard output in YAML format.
+
+h3. Usage
+
+!usage specification
+
+h3. Examples
+
+Here is the specification from rake 0.4.1.
+
+<pre>
+$ gem spec rake -v 0.4.1
+--- !ruby/object:Gem::Specification 
+rubygems_version: "0.6"
+name: rake
+version: !ruby/object:Gem::Version 
+  version: 0.4.1
+date: 2004-07-02 01:08:54.678603 -04:00
+platform: 
+summary: Ruby based make-like utility.
+require_paths: 
+  - lib
+files: 
+  - install.rb
+  - CHANGES
+  - Rakefile
+  - README
+  - TODO
+  - MIT-LICENSE
+  - bin/rake
+  - lib/rake.rb
+  - lib/rake/clean.rb
+  ......
+</pre>
+
+<hr/>
+
+== gem uninstall -- Uninstalling a gem
+
+The uninstall will uninstall the named gem.  If multiple versions of a
+gem are installed, you will be prompted to select a single one, or all
+of them.
+
+h3. Usage
+
+!usage uninstall
+
+h3. Examples
+
+The following uninstalls the only copy of copland.
+
+<pre>
+$ gem uninstall copland
+Attempting to uninstall gem 'copland'
+Successfully uninstalled copland version 0.3.0
+</pre>
+
+The following uninstalls all the installed versions of the rake gem.
+Since rake is an application, it has a ApplicationStub installed.  The
+uninstall removes the stub as well.
+
+<pre>
+$ sudo gem uninstall rake
+Attempting to uninstall gem 'rake'
+
+Select RubyGem to uninstall:
+ 1. rake-0.3.2
+ 2. rake-0.4.0
+ 3. All versions
+> 3
+Successfully uninstalled rake version 0.3.2
+Successfully uninstalled rake version 0.4.0
+WARNING:  About to remove executables and scripts for: rake
+Proceed? [Y/n]  y
+Removing rake
+</pre>
+
+<hr/>
+
+== gem unpack -- Unpack an installed gem to the current directory
+
+<em>(Not in version 0.7.)</em>
+
+The unpack command creates a private copy of the named gem's contents into a
+new directory.  This enables you to examine the contents without interfering
+with the gem repository.
+
+You can only unpack gems that you have installed, and you must specify the gem
+name exactly.
+
+h3. Usage
+
+!usage unpack
+
+h3. Examples
+
+<pre>
+$ gem unpack rake
+Unpacked gem: 'rake-0.4.3'
+
+$ ls rake-0.4.3/
+CHANGES  MIT-LICENSE  README  Rakefile  TODO  bin  doc  install.rb  lib  test
+
+$ gem unpack wazoo
+ERROR:  Gem 'wazoo' not installed.
+</pre>
+
+<hr/>
+
+== gem update -- Update your installed gems
+
+The update command will check the named gem (or all of your installed
+gems if no name is given) and update each one to a newer version if
+one is available.
+
+h3. Usage
+
+!usage update
+
+h3. Examples
+
+<pre>
+$ gem update
+Upgrading installed gems...
+Attempting remote upgrade of activerecord
+Attempting remote installation of 'activerecord'
+Successfully installed activerecord, version 0.8.4
+Attempting remote upgrade of csbattery
+Attempting remote installation of 'csbattery'
+Successfully installed csbattery, version 0.2.2
+All gems up to date
+</pre>
+
+<hr/>
+
diff -pruN 1.2.0-2/scripts/specdoc.data 1.3.0~RC1-0ubuntu1/scripts/specdoc.data
--- 1.2.0-2/scripts/specdoc.data	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/scripts/specdoc.data	2008-08-27 17:30:05.000000000 +0100
@@ -0,0 +1,33 @@
+p(((. <em>This page is generated by <tt>hieraki</tt> rake task in the
+RubyGems CVS.  Any changes to this page will be lost.  Contact a
+member of the RubyGems team if you have suggestions.</em>
+
+!timestamp
+
+h3. Introduction
+
+In order to create a gem, you need to define a gem specification, commonly
+called a "gemspec".
+
+A gemspec consists of several _attributes_.  Some of these are required;
+most of them are optional.  The main body of this document is an alphabetical
+list of gemspec attributes, each with a description, example usage, notes, and
+more.
+
+See also:
+
+h3. <a name="toc">Important Attributes</a>
+
+!important_toc name version platform summary require_paths files dependencies
+
+h3. Alphabetical
+
+!alpha_toc
+
+h3. Themed
+
+!themed_toc
+
+h2. Attribute Survey
+
+!attribute_survey
diff -pruN 1.2.0-2/scripts/specdoc.yaml 1.3.0~RC1-0ubuntu1/scripts/specdoc.yaml
--- 1.2.0-2/scripts/specdoc.yaml	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/scripts/specdoc.yaml	2008-08-27 17:30:05.000000000 +0100
@@ -0,0 +1,433 @@
+SECTIONS:
+  - name: "Basics"
+    attributes:
+      - name
+      - version
+      - summary
+      - description                     
+      - platform                        
+      - required_ruby_version           
+      - requirements
+      - dependencies
+  
+  - name: "Files, Libraries, and Executables"
+    attributes:
+      - files                           
+      - require_paths
+      - autorequire                     
+      - bindir                          
+      - executables                     
+      - default_executable              
+  
+  - name: "C compilation"
+    attributes:
+      - extensions                      
+  
+  - name: "Documentation"
+    attributes:
+      - rdoc_options                    
+      - has_rdoc                        
+      - extra_rdoc_files
+  
+  - name: "Testing"
+    attributes:
+      - test_files
+  
+  - name: "About"
+    attributes:
+      - authors                          
+      - email                           
+      - homepage                        
+      - rubyforge_project               
+
+ATTRIBUTES:
+
+  - name: authors
+    klass: String
+    mandatory: false
+    default: 
+    description:
+      The author of the package contained in the gem.
+    usage: |
+        spec.author = "John Jones"
+    notes:
+
+  - name: autorequire
+    klass: String
+    mandatory: false
+    default: nil
+    description:
+      The file that will be loaded when <tt>require_gem</tt> is called.
+    usage: |
+        spec.files = ['lib/rake.rb", "lib/rake/**/*.rb", ...]
+        spec.autorequire = 'rake'
+    notes:
+      "In the above example, when the user's code calls <tt>require_gem
+      'rake'</tt>, an implicit <tt>require 'rake'</tt> is called afterwards.
+      It is a shortcut so the user doesn't have to do what seems to be a
+      redundant <tt>require</tt>.
+
+      Specifying <tt>autorequire</tt> is optional.  If there is no single
+      default file that should be loaded, then it doesn't make sense to
+      specify it."
+
+  - name: bindir
+    klass: String
+    mandatory: false
+    default: bin
+    description:
+      The directory containing the application files, if any.
+    usage: |
+        spec.bindir = 'bin'
+    notes:
+      An "application file" is a file that is intended to be run from the
+      command line.  If your package contains such files, they will typically
+      be placed in a <tt>bin</tt> directory, hence the name *bindir*.
+
+  - name: date
+    klass: Time
+    mandatory: true
+    default: Time.now
+    description:
+      The date/time that the gem was created.
+    usage: |
+        spec.date = File.utime('VERSION')
+    notes:
+      It's generally sufficient to leave it to the default.
+
+  - name: default_executable
+    klass: String
+    mandatory: false
+    default: ...
+    description:
+      Of all the application files in the package, the *default executable*
+      is the one that can be run directly through the gem.
+    usage: |
+        spec.executables = ['bin/foo', 'bin/bar']
+        spec.default_executable = 'bin/bar'
+    notes:
+      "If you only specify one application file in *executables*, that file
+      becomes the default executable.  Therefore, you only need to specify
+      this value if you have more than one application file.
+
+      The notion of running applications directly through a gem is not well
+      supported at the moment.  The idea is that you can download a gem, say
+      <tt>monopoly.gem</tt> (the board game), and run <tt>gem
+      monopoly.gem</tt>, which would run the <tt>monopoly</tt> application.
+      This is not an in-demand feature.
+
+      <em>XXX: Is the full path necessary?</em>"
+
+  - name: dependencies
+    klass: Array
+    mandatory: false
+    default: []
+    description:
+      Lists the gems that must be installed for this gem to work.
+    usage: |
+        spec.add_dependency('log4r', '>= 1.0.5')
+    notes:
+      When installing a gem with <tt>gem install ...</tt>, its dependencies
+      will be checked.  If they are not installed, <tt>gem</tt> will offer to
+      install them.
+
+      See also L(requirements).
+
+  - name: description
+    klass: String
+    mandatory: false
+    default: 
+    description:
+      Detailed description of the gem.  See also L(summary).
+    usage: |
+        spec.description = <<-EOF
+          Rake is a Make-like program implemented in Ruby. Tasks and
+          dependencies are specified in standard Ruby syntax.
+        EOF
+    notes:
+      When the gem is built, the description is re-formatted into a single
+      line with sensible whitespace.  This means you can use here-docs with
+      formatting, as demonstrated above, without worrying about the
+      formatting.
+
+      The _description_ should be more detailed than the _summary_.  You
+      might consider copying all or part of your project's README into this
+      field.
+
+  - name: email
+    klass: String
+    mandatory: false
+    default: 
+    description:
+      The author's email address.
+    usage: |
+        spec.email = 'john.jones at example.com'
+    notes:
+
+  - name: executables
+    klass: Array
+    mandatory: false
+    default: 
+    description:
+      A list of files in the package that are applications.
+    usage: |
+        # XXX: is this correct?
+        spec.executables << 'rake'
+    notes:
+      For example, the <tt>rake</tt> gem has <tt>rake</tt> as an executable.
+      You don't specify the full path (as in <tt>bin/rake</tt>); all
+      application-style files are expected to be found in L(bindir).
+
+  - name: extensions
+    klass: Array
+    mandatory: false
+    default: 
+    description:
+      The paths to <tt>extconf.rb</tt>-style files used to compile
+      extensions.
+    usage: |
+        spec.extensions << 'ext/rmagic/extconf.rb'
+    notes:
+      "These files will be run when the gem is installed, causing the C (or
+      whatever) code to be compiled on the user's machine.
+
+      <em>XXX: Any other comments?</em>"
+
+  - name: extra_rdoc_files
+    klass: Array
+    mandatory: false
+    default: 
+    description:
+      A list of _extra_ files that will be used by RDoc to generate the
+      documentation.
+    usage: |
+        spec.extra_rdoc_files = ['README', 'doc/user-guide.txt']
+    notes:
+      When the user elects to generate the RDoc documentation for a gem
+      (typically at install time), all the library files are sent to RDoc for
+      processing.  This option allows you to have some non-code files included
+      for a more complete set of documentation.
+
+  - name: files
+    klass: Array
+    mandatory: false
+    default: 
+    description:
+      The list of files to be contained in the gem.
+    usage: |
+        require 'rake'
+        spec.files = FileList['lib/**/*.rb', 'bin/*', '[A-Z]*', 'test/**/*'].to_a
+
+        # or without Rake...
+        spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
+        spec.files << Dir['[A-Z]*'] + Dir['test/**/*']
+        spec.files.reject! { |fn| fn.include? "CVS" }
+    notes:
+      You don't need to use Rake, obviously, but it does make it much easier to
+      specify files, as it automatically excludes CVS files, backups, etc.
+
+  - name: has_rdoc
+    klass: boolean
+    mandatory: false
+    default: false
+    description:
+      Indicates whether the code in the gem has been commented with RDoc in
+      mind.
+    usage: |
+        spec.has_rdoc = true
+    notes:
+      This attribute has an advisory role only.  Any gem can be submitted for
+      RDoc processing.
+
+  - name: homepage
+    klass: String
+    mandatory: false
+    default: 
+    description:
+      URL of the project or author.
+    usage: |
+        spec.hompage = 'http://rake.rubyforge.org'
+    notes:
+
+  - name: name
+    klass: String
+    mandatory: true
+    default: 
+    description:
+      The name of the gem.
+    usage: |
+        spec.name = 'rake'
+    notes:
+      The name does not include the version number; see L(version).
+
+  - name: platform
+    klass: String
+    mandatory: true
+    default: Gem::Platform::Ruby
+    description:
+      The target platform for the gem.
+    usage: |
+        spec.platform = Gem::Platform::WIN32
+    notes:
+      Most gems contain pure Ruby code; they should simply leave the default
+      value in place.  Some gems contain C (or other) code to be compiled into
+      a Ruby "extension".  The should leave the default value in place unless
+      their code will only compile on a certain type of system.  Some gems 
+      consist of pre-compiled code ("binary gems").  It's especially important 
+      that they set the _platform_ attribute appropriately.  A shortcut is
+      to set the platform to Gem::Platform::CURRENT, which will cause the 
+      gem builder to set the platform to the appropriate value for the system
+      on which the build is being performed.
+
+      If this attribute is set to a non-default value, it will be included in
+      the filename of the gem when it is built, e.g.
+      <tt>fxruby-1.2.0-win32.gem</tt>.
+
+  - name: rdoc_options
+    klass: Array
+    mandatory: false
+    default: []
+    description:
+      Specifies the <tt>rdoc</tt> options to be used when generating API
+      documentation.
+    usage: |
+        spec.rdoc_options << '--title' << 'Rake -- Ruby Make' <<
+                             '--main' << 'README' <<
+                             '--line-numbers'
+    notes:
+
+  - name: require_paths
+    klass: Array
+    mandatory: true
+    default: ['lib']
+    description:
+      List of ''require'' paths from the root of the gem.
+    usage: |
+        # If all library files are in the root directory...
+        spec.require_path = '.'
+
+        # If you have 'lib' and 'ext' directories...
+        spec.require_paths << 'ext'
+    notes:
+      "The default is sufficient in most cases, as Ruby packages tend to be
+      structured so that library code is found under the <tt>lib</tt>
+      directory.
+
+      The example above shows that you can use <tt>spec.require_path =
+      '...'</tt> instead of <tt>spec.require_paths = [...]</tt>.  This is a
+      shortcut, acknowledging that nearly all gems will have only one require
+      path element.
+
+      Be careful about interpreting this attribute, however.  It is used to
+      modify the <tt>LOAD_PATH</tt>, and thus to resolve <tt>require</tt>
+      calls.  So if code calls <tt>require 'rake/packagetask'</tt>, for
+      example, and the <tt>require_paths</tt> is set to <tt>lib</tt>, then
+      there had better be a file <tt>lib/rake/packagetask.rb</tt>."
+
+  - name: required_ruby_version
+    klass: Gem::Version::Requirement
+    mandatory: false
+    default: '> 0.0.0'
+    description:
+      The version of Ruby required to use the gem.
+    usage: |
+        # If it will work with 1.6.8 or greater...
+        spec.required_ruby_version = '>= 1.6.8'
+
+        # ...but not with 1.7/1.8...
+        spec.required_ruby_version = '~> 1.6.8'
+
+        # The typical case these days...
+        spec.required_ruby_version = '>= 1.8.1'
+    notes:
+      See the RubyGems wiki for documentation on specifying versions.
+
+  - name: rubygems_version
+    klass: String
+    mandatory: false
+    default: '<em>current version of RubyGems</em>'
+    description:
+      The version of RubyGems used to create this gem.
+    usage: |
+        No usage ... it is set automatically when the gem is created.
+
+  - name: specification_version
+    klass: Integer
+    mandatory: false
+    default: '<em>Revision level of the RubyGems specification this gem conforms to.</em>'
+    description:
+      The revision level of the GemSpec specification that this gem conforms to.
+    usage: |
+        No usage ... it is set automatically when the gem is created.
+
+  - name: requirements
+    klass: Array
+    mandatory: false
+    default: []
+    description:
+      Lists the external (to <nowiki>RubyGems</nowiki>) requirements that must
+      be met for this gem to work.  It's simply information for the user.
+    usage: |
+        spec.requirements << 'libmagick, v6.0 or greater'
+        spec.requirements << 'A powerful graphics card'
+    notes:
+      For requirements that can be met by other gems, see L(dependencies).
+
+  - name: rubyforge_project
+    klass: String
+    mandatory: false
+    default: 
+    description:
+      The RubyForge project corresponding to the gem.
+    usage: |
+        spec.rubyforge_project = 'rake'
+    notes:
+      Obviously, if your gem doesn't have a Rubyforge project, leave this
+      setting alone.
+
+  - name: summary
+    klass: String
+    mandatory: true
+    default: 
+    description:
+      A short description of the gem.
+    usage: |
+        spec.summary = 'Ruby based make-like utility.'
+    notes:
+      The summary is used to describe the gem in lists produced by the
+      <tt>gem</tt> tool.  See also L(description), which is less important.
+
+  - name: test_files
+    klass: Array
+    mandatory: false
+    default: []
+    description:
+      A collection of unit test files.  They will be loaded as unit tests when
+      the user requests a gem to be unit tested.
+    usage: |
+        spec.test_files = Dir.glob('test/tc_*.rb')     # (1)
+        spec.test_file  = 'tests/test-suite.rb'        # (2)
+        spec.test_files = ['tests/test-suite.rb']      # (3)
+    notes: >
+      Example (1) specifies that all files matching <tt>tc_*.rb</tt> in the
+      <tt>test</tt> directory are unit test files.
+
+      Example (2) shows that you can specify a test suite instead, which
+      presumably loads individual test cases.  This uses the shortcut method
+      <tt>test_file=</tt>, and has the same effect as example (3).
+
+  - name: version
+    klass: String
+    mandatory: true
+    default: 
+    description:
+      The version of the gem.  See RationalVersioningPolicy for some
+      advice on specifying the version number for your gem.
+    usage: |
+        spec.version = '0.4.1'
+    notes: 
+      The canonical way to represent versions in RubyGems is with the
+      <tt>Gem::Version</tt> class.  But the practical way to specify it in a
+      gemspec is with a String.
+
+      The version string must consist purely of numbers and periods.
diff -pruN 1.2.0-2/setup.rb 1.3.0~RC1-0ubuntu1/setup.rb
--- 1.2.0-2/setup.rb	2008-06-22 00:51:11.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/setup.rb	2008-08-27 17:30:06.000000000 +0100
@@ -90,14 +90,17 @@ HELP
   end
 end
 
-unless install_destdir.empty? then
-  ENV['GEM_HOME'] ||= File.join(install_destdir,
-                                Gem.default_dir.sub(/\A[a-z]:/i, ''))
-end
-
 require 'fileutils'
 require 'rbconfig'
 require 'tmpdir'
+require 'pathname'
+
+unless install_destdir.empty? then
+  default_dir = Pathname.new(Gem.default_dir)
+  top_dir = Pathname.new(RbConfig::TOPDIR)
+  ENV['GEM_HOME'] ||= File.join(install_destdir,
+                                default_dir.relative_path_from(top_dir))
+end
 
 include FileUtils::Verbose
 
@@ -134,8 +137,12 @@ else
 end
 
 unless install_destdir.empty?
-  lib_dir = File.join install_destdir, lib_dir
-  bin_dir = File.join install_destdir, bin_dir
+  top_dir = Pathname.new(RbConfig::TOPDIR)
+  lib_dir_p = Pathname.new(lib_dir)
+  bin_dir_p = Pathname.new(bin_dir)
+
+  lib_dir = File.join install_destdir, lib_dir_p.relative_path_from(top_dir)
+  bin_dir = File.join install_destdir, bin_dir_p.relative_path_from(top_dir)
 end
 
 mkdir_p lib_dir
@@ -324,3 +331,4 @@ puts "If `gem` was installed by a previo
 puts "to remove it by hand."
 puts
 
+
diff -pruN 1.2.0-2/test/gemutilities.rb 1.3.0~RC1-0ubuntu1/test/gemutilities.rb
--- 1.2.0-2/test/gemutilities.rb	2008-06-17 23:36:35.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/gemutilities.rb	2008-08-27 17:30:05.000000000 +0100
@@ -7,6 +7,8 @@
 
 at_exit { $SAFE = 1 }
 
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
 require 'fileutils'
 require 'test/unit'
 require 'tmpdir'
@@ -17,6 +19,10 @@ require 'rubygems/test_utilities'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'mockgemui')
 
 module Gem
+  def self.searcher=(searcher)
+    MUTEX.synchronize do @searcher = searcher end
+  end
+
   def self.source_index=(si)
     @@source_index = si
   end
@@ -24,6 +30,10 @@ module Gem
   def self.win_platform=(val)
     @@win_platform = val
   end
+
+  module DefaultUserInteraction
+    @ui = MockGemUi.new
+  end
 end
 
 class RubyGemTestCase < Test::Unit::TestCase
@@ -83,6 +93,27 @@ class RubyGemTestCase < Test::Unit::Test
                                               'private_key.pem')
     @public_cert = File.expand_path File.join(File.dirname(__FILE__),
                                               'public_cert.pem')
+
+    Gem.post_install_hooks.clear
+    Gem.post_uninstall_hooks.clear
+    Gem.pre_install_hooks.clear
+    Gem.pre_uninstall_hooks.clear
+
+    Gem.post_install do |installer|
+      @post_install_hook_arg = installer
+    end
+
+    Gem.post_uninstall do |uninstaller|
+      @post_uninstall_hook_arg = uninstaller
+    end
+
+    Gem.pre_install do |installer|
+      @pre_install_hook_arg = installer
+    end
+
+    Gem.pre_uninstall do |uninstaller|
+      @pre_uninstall_hook_arg = uninstaller
+    end
   end
 
   def teardown
diff -pruN 1.2.0-2/test/mockgemui.rb 1.3.0~RC1-0ubuntu1/test/mockgemui.rb
--- 1.2.0-2/test/mockgemui.rb	2008-03-28 20:56:15.000000000 +0000
+++ 1.3.0~RC1-0ubuntu1/test/mockgemui.rb	2008-08-27 17:30:05.000000000 +0100
@@ -12,8 +12,28 @@ require 'rubygems/user_interaction'
 class MockGemUi < Gem::StreamUI
   class TermError < RuntimeError; end
 
-  def initialize(input="")
-    super(StringIO.new(input), StringIO.new, StringIO.new)
+  module TTY
+
+    attr_accessor :tty
+
+    def tty?()
+      @tty = true unless defined?(@tty)
+      @tty
+    end
+
+  end
+
+  def initialize(input = "")
+    ins = StringIO.new input
+    outs = StringIO.new
+    errs = StringIO.new
+
+    ins.extend TTY
+    outs.extend TTY
+    errs.extend TTY
+
+    super ins, outs, errs
+
     @terminated = false
   end
 
diff -pruN 1.2.0-2/test/test_gem_commands_dependency_command.rb 1.3.0~RC1-0ubuntu1/test/test_gem_commands_dependency_command.rb
--- 1.2.0-2/test/test_gem_commands_dependency_command.rb	2008-06-19 01:22:19.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_commands_dependency_command.rb	2008-08-27 17:30:05.000000000 +0100
@@ -199,7 +199,7 @@ ERROR:  Only reverse dependencies for lo
     @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] =
       si.dump
 
-    @fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] = nil
+    @fetcher.data.delete "#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"
 
     FileUtils.rm File.join(@gemhome, 'specifications',
                            "#{foo.full_name}.gemspec")
diff -pruN 1.2.0-2/test/test_gem_commands_list_command.rb 1.3.0~RC1-0ubuntu1/test/test_gem_commands_list_command.rb
--- 1.2.0-2/test/test_gem_commands_list_command.rb	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_commands_list_command.rb	2008-08-27 17:30:05.000000000 +0100
@@ -0,0 +1,37 @@
+require 'test/unit'
+require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
+require 'rubygems/commands/list_command'
+
+class TestGemCommandsListCommand < RubyGemTestCase
+
+  def setup
+    super
+
+    @cmd = Gem::Commands::ListCommand.new
+
+    util_setup_fake_fetcher
+
+    @si = util_setup_spec_fetcher @a1, @a2, @pl1
+
+    @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
+      raise Gem::RemoteFetcher::FetchError
+    end
+  end
+
+  def test_execute_installed
+    @cmd.handle_options %w[c --installed]
+
+    e = assert_raise Gem::SystemExitException do
+      use_ui @ui do
+        @cmd.execute
+      end
+    end
+
+    assert_equal 0, e.exit_code
+
+    assert_equal "true\n", @ui.output
+
+    assert_equal '', @ui.error
+  end
+
+end
diff -pruN 1.2.0-2/test/test_gem_commands_query_command.rb 1.3.0~RC1-0ubuntu1/test/test_gem_commands_query_command.rb
--- 1.2.0-2/test/test_gem_commands_query_command.rb	2008-06-16 04:25:51.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_commands_query_command.rb	2008-08-27 17:30:05.000000000 +0100
@@ -180,7 +180,7 @@ pl (1)
     @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] =
       si.dump
 
-    @fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] = nil
+    @fetcher.data.delete "#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"
 
     @cmd.handle_options %w[-r]
 
@@ -265,6 +265,27 @@ pl (1)
     assert_equal '', @ui.error
   end
 
+  def test_execute_local_notty
+    @cmd.handle_options %w[]
+
+    @ui.outs.tty = false
+
+    use_ui @ui do
+      @cmd.execute
+    end
+
+    expected = <<-EOF
+a (2, 1)
+a_evil (9)
+b (2)
+c (1.2)
+pl (1)
+    EOF
+
+    assert_equal expected, @ui.output
+    assert_equal '', @ui.error
+  end
+
   def test_execute_no_versions
     @cmd.handle_options %w[-r --no-versions]
 
@@ -284,5 +305,23 @@ pl
     assert_equal '', @ui.error
   end
 
+  def test_execute_notty
+    @cmd.handle_options %w[-r]
+
+    @ui.outs.tty = false
+
+    use_ui @ui do
+      @cmd.execute
+    end
+
+    expected = <<-EOF
+a (2)
+pl (1)
+    EOF
+
+    assert_equal expected, @ui.output
+    assert_equal '', @ui.error
+  end
+
 end
 
diff -pruN 1.2.0-2/test/test_gem_commands_uninstall_command.rb 1.3.0~RC1-0ubuntu1/test/test_gem_commands_uninstall_command.rb
--- 1.2.0-2/test/test_gem_commands_uninstall_command.rb	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_commands_uninstall_command.rb	2008-08-27 17:30:05.000000000 +0100
@@ -0,0 +1,60 @@
+require 'test/unit'
+require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
+require File.join(File.expand_path(File.dirname(__FILE__)),
+                  'gem_installer_test_case')
+require 'rubygems/commands/uninstall_command'
+
+class TestGemCommandsUninstallCommand < GemInstallerTestCase
+
+  def setup
+    super
+
+    ui = MockGemUi.new
+    util_setup_gem ui
+
+    use_ui ui do
+      @installer.install
+    end
+
+    @cmd = Gem::Commands::UninstallCommand.new
+    @cmd.options[:executables] = true
+    @executable = File.join(@gemhome, 'bin', 'executable')
+  end
+
+  def test_execute_removes_executable
+    if win_platform?
+      assert_equal true, File.exist?(@executable)
+    else
+      assert_equal true, File.symlink?(@executable)
+    end
+
+    # Evil hack to prevent false removal success
+    FileUtils.rm_f @executable
+    File.open(@executable, "wb+") {|f| f.puts "binary"}
+
+    @cmd.options[:args] = Array(@spec.name)
+    use_ui @ui do
+      @cmd.execute
+    end
+
+    output = @ui.output.split "\n"
+    assert_match(/Removing executable/, output.shift)
+    assert_match(/Successfully uninstalled/, output.shift)
+    assert_equal false, File.exist?(@executable)
+    assert_nil output.shift, "UI output should have contained only two lines"
+  end
+
+  def test_execute_not_installed
+    @cmd.options[:args] = ["foo"]
+    e = assert_raise(Gem::InstallError) do
+      use_ui @ui do
+        @cmd.execute
+      end
+    end
+
+    assert_match(/\AUnknown gem foo >= 0$/, e.message)
+    output = @ui.output.split "\n"
+    assert output.empty?, "UI output should be empty after an uninstall error"
+  end
+end
+
diff -pruN 1.2.0-2/test/test_gem_config_file.rb 1.3.0~RC1-0ubuntu1/test/test_gem_config_file.rb
--- 1.2.0-2/test/test_gem_config_file.rb	2008-06-18 09:25:20.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_config_file.rb	2008-08-27 17:30:05.000000000 +0100
@@ -22,11 +22,15 @@ class TestGemConfigFile < RubyGemTestCas
     Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
     Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
                          File.join(@tempdir, 'system-gemrc')
+    Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS.clear
+    Gem::ConfigFile::PLATFORM_DEFAULTS.clear
 
     util_config_file
   end
 
   def teardown
+    Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS.clear
+    Gem::ConfigFile::PLATFORM_DEFAULTS.clear
     Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
     Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
                          @orig_SYSTEM_WIDE_CONFIG_FILE
@@ -84,6 +88,48 @@ class TestGemConfigFile < RubyGemTestCas
     assert_equal @temp_conf, @cfg.config_file_name
   end
 
+  def test_initialize_operating_system_override
+    Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS[:bulk_threshold] = 1
+    Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS['install'] = '--no-env-shebang'
+
+    Gem::ConfigFile::PLATFORM_DEFAULTS[:bulk_threshold] = 2
+
+    util_config_file
+
+    assert_equal 2, @cfg.bulk_threshold
+    assert_equal '--no-env-shebang', @cfg[:install]
+  end
+
+  def test_initialize_platform_override
+    Gem::ConfigFile::PLATFORM_DEFAULTS[:bulk_threshold] = 2
+    Gem::ConfigFile::PLATFORM_DEFAULTS['install'] = '--no-env-shebang'
+
+    File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, 'w' do |fp|
+      fp.puts ":bulk_threshold: 3"
+    end
+
+    util_config_file
+
+    assert_equal 3, @cfg.bulk_threshold
+    assert_equal '--no-env-shebang', @cfg[:install]
+  end
+
+  def test_initialize_system_wide_override
+    File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, 'w' do |fp|
+      fp.puts ":backtrace: false"
+      fp.puts ":bulk_threshold: 2048"
+    end
+
+    File.open @temp_conf, 'w' do |fp|
+      fp.puts ":backtrace: true"
+    end
+
+    util_config_file
+
+    assert_equal 2048, @cfg.bulk_threshold
+    assert_equal true, @cfg.backtrace
+  end
+
   def test_handle_arguments
     args = %w[--backtrace --bunch --of --args here]
 
@@ -222,23 +268,6 @@ class TestGemConfigFile < RubyGemTestCas
     assert_equal %w[http://even-more-gems.example.com], Gem.sources
   end
 
-  def test_global_config_file
-    File.open(@temp_conf, 'w') do |fp|
-      fp.puts ":backtrace: true"
-    end
-
-    File.open(File.join(Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE),
-                'w') do |fp|
-      fp.puts ":backtrace: false"
-      fp.puts ":bulk_threshold: 2048"
-                end
-
-    util_config_file
-
-    assert_equal 2048, @cfg.bulk_threshold
-    assert @cfg.backtrace
-  end
-
   def util_config_file(args = @cfg_args)
     @cfg = Gem::ConfigFile.new args
   end
diff -pruN 1.2.0-2/test/test_gem_ext_configure_builder.rb 1.3.0~RC1-0ubuntu1/test/test_gem_ext_configure_builder.rb
--- 1.2.0-2/test/test_gem_ext_configure_builder.rb	2008-02-20 04:51:20.000000000 +0000
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_ext_configure_builder.rb	2008-08-27 17:30:05.000000000 +0100
@@ -29,12 +29,12 @@ class TestGemExtConfigureBuilder < RubyG
       Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output
     end
 
-    expected = [
-      "sh ./configure --prefix=#{@dest_path}",
-      "", "make", "ok\n", "make install", "ok\n"
-    ]
-
-    assert_equal expected, output
+    assert_equal "sh ./configure --prefix=#{@dest_path}", output.shift
+    assert_equal "", output.shift
+    assert_equal "make", output.shift
+    assert_match(/^ok$/m, output.shift)
+    assert_equal "make install", output.shift
+    assert_match(/^ok$/m, output.shift)
   end
 
   def test_self_build_fail
@@ -47,9 +47,9 @@ class TestGemExtConfigureBuilder < RubyG
       end
     end
 
-    shell_error_msg = %r{(\./configure: No such file or directory)|(Can't open \./configure)}
+    shell_error_msg = %r{(\./configure: .*)|(Can't open \./configure)}
     sh_prefix_configure = "sh ./configure --prefix="
-    
+
     expected = %r(configure failed:
 
 #{Regexp.escape sh_prefix_configure}#{Regexp.escape @dest_path}
diff -pruN 1.2.0-2/test/test_gem_ext_rake_builder.rb 1.3.0~RC1-0ubuntu1/test/test_gem_ext_rake_builder.rb
--- 1.2.0-2/test/test_gem_ext_rake_builder.rb	2007-11-10 03:11:06.000000000 +0000
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_ext_rake_builder.rb	2008-08-27 17:30:05.000000000 +0100
@@ -34,7 +34,7 @@ class TestGemExtRakeBuilder < RubyGemTes
     expected = [
       "#{Gem.ruby} mkrf_conf.rb",
       "",
-      "rake RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}",
+      "#{ENV['rake'] || 'rake'} RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}",
       "(in #{realdir})\n"
     ]
 
@@ -63,7 +63,7 @@ rake failed:
 
 #{Gem.ruby} mkrf_conf.rb
 
-rake RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}
+#{ENV['rake'] || 'rake'} RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}
     EOF
 
     assert_equal expected, error.message.split("\n")[0..4].join("\n")
diff -pruN 1.2.0-2/test/test_gem_gem_path_searcher.rb 1.3.0~RC1-0ubuntu1/test/test_gem_gem_path_searcher.rb
--- 1.2.0-2/test/test_gem_gem_path_searcher.rb	2008-05-24 01:18:24.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_gem_path_searcher.rb	2008-08-27 17:30:05.000000000 +0100
@@ -5,10 +5,6 @@ require 'rubygems/gem_path_searcher'
 class Gem::GemPathSearcher
   attr_accessor :gemspecs
   attr_accessor :lib_dirs
-
-  public :init_gemspecs
-  public :matching_file
-  public :lib_dirs_for
 end
 
 class TestGemGemPathSearcher < RubyGemTestCase
@@ -40,6 +36,10 @@ class TestGemGemPathSearcher < RubyGemTe
     assert_equal @foo1, @gps.find('foo')
   end
 
+  def test_find_all
+    assert_equal [@foo1], @gps.find_all('foo')
+  end
+
   def test_init_gemspecs
     assert_equal [@bar2, @bar1, @foo2, @foo1], @gps.init_gemspecs
   end
@@ -51,9 +51,17 @@ class TestGemGemPathSearcher < RubyGemTe
     assert_equal expected, lib_dirs
   end
 
-  def test_matching_file
-    assert !@gps.matching_file(@foo1, 'bar')
-    assert @gps.matching_file(@foo1, 'foo')
+  def test_matching_file_eh
+    assert !@gps.matching_file?(@foo1, 'bar')
+    assert @gps.matching_file?(@foo1, 'foo')
+  end
+
+  def test_matching_files
+    assert_equal [], @gps.matching_files(@foo1, 'bar')
+
+    expected = File.join @foo1.full_gem_path, 'lib', 'foo.rb'
+
+    assert_equal [expected], @gps.matching_files(@foo1, 'foo')
   end
 
 end
diff -pruN 1.2.0-2/test/test_gem_indexer.rb 1.3.0~RC1-0ubuntu1/test/test_gem_indexer.rb
--- 1.2.0-2/test/test_gem_indexer.rb	2008-06-17 08:55:44.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_indexer.rb	2008-08-27 17:30:05.000000000 +0100
@@ -21,7 +21,6 @@ class TestGemIndexer < RubyGemTestCase
     util_make_gems
 
     @d2_0 = quick_gem 'd', '2.0'
-    write_file File.join(*%W[gems #{@d2_0.original_name} lib code.rb]) do end
     util_build_gem @d2_0
 
     gems = File.join(@tempdir, 'gems')
@@ -38,6 +37,41 @@ class TestGemIndexer < RubyGemTestCase
                  @indexer.directory
   end
 
+  def test_build_indicies
+    spec = quick_gem 'd', '2.0'
+    spec.instance_variable_set :@original_platform, ''
+
+    @indexer.make_temp_directories
+
+    index = Gem::SourceIndex.new
+    index.add_spec spec
+
+    use_ui @ui do
+      @indexer.build_indicies index
+    end
+
+    specs_path = File.join @indexer.directory, "specs.#{@marshal_version}"
+    specs_dump = Gem.read_binary specs_path
+    specs = Marshal.load specs_dump
+
+    expected = [
+      ['d',      Gem::Version.new('2.0'), 'ruby'],
+    ]
+
+    assert_equal expected, specs, 'specs'
+
+    latest_specs_path = File.join @indexer.directory,
+                                  "latest_specs.#{@marshal_version}"
+    latest_specs_dump = Gem.read_binary latest_specs_path
+    latest_specs = Marshal.load latest_specs_dump
+
+    expected = [
+      ['d',      Gem::Version.new('2.0'), 'ruby'],
+    ]
+
+    assert_equal expected, latest_specs, 'latest_specs'
+  end
+
   def test_generate_index
     use_ui @ui do
       @indexer.generate_index
diff -pruN 1.2.0-2/test/test_gem_installer.rb 1.3.0~RC1-0ubuntu1/test/test_gem_installer.rb
--- 1.2.0-2/test/test_gem_installer.rb	2008-06-19 00:05:12.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_installer.rb	2008-08-27 17:30:05.000000000 +0100
@@ -515,6 +515,7 @@ load 'my_exec'
     spec = quick_gem 'a' do |s| s.platform = Gem::Platform.new 'mswin32' end
     gem = File.join @tempdir, "#{spec.full_name}.gem"
 
+    Dir.mkdir util_inst_bindir
     util_build_gem spec
     FileUtils.mv File.join(@gemhome, 'cache', "#{spec.full_name}.gem"),
                  @tempdir
@@ -525,8 +526,19 @@ load 'my_exec'
   end
 
   def test_install
+    Dir.mkdir util_inst_bindir
     util_setup_gem
 
+    cache_file = File.join @gemhome, 'cache', "#{@spec.full_name}.gem"
+
+    Gem.pre_install do |installer|
+      assert !File.exist?(cache_file), 'cache file should not exist yet'
+    end
+
+    Gem.post_install do |installer|
+      assert File.exist?(cache_file), 'cache file should exist'
+    end
+
     use_ui @ui do
       assert_equal @spec, @installer.install
     end
@@ -548,6 +560,9 @@ load 'my_exec'
 
     assert_equal spec_file, @spec.loaded_from
     assert File.exist?(spec_file)
+
+    assert_same @installer, @pre_install_hook_arg
+    assert_same @installer, @post_install_hook_arg
   end
 
   def test_install_bad_gem
@@ -582,6 +597,29 @@ load 'my_exec'
     end
   end
 
+  def test_install_check_dependencies_install_dir
+    gemhome2 = "#{@gemhome}2"
+    @spec.add_dependency 'b'
+
+    b2 = quick_gem 'b', 2
+
+    FileUtils.mv @gemhome, gemhome2
+    Gem.source_index.gems.delete b2.full_name
+    source_index = Gem::SourceIndex.from_gems_in File.join(gemhome2,
+                                                           'specifications')
+
+    util_setup_gem
+
+    @installer = Gem::Installer.new @gem, :install_dir => gemhome2,
+                                    :source_index => source_index
+
+    use_ui @ui do
+      @installer.install
+    end
+
+    assert File.exist?(File.join(gemhome2, 'gems', @spec.full_name))
+  end
+
   def test_install_force
     use_ui @ui do
       installer = Gem::Installer.new old_ruby_required, :force => true
@@ -593,6 +631,7 @@ load 'my_exec'
   end
 
   def test_install_ignore_dependencies
+    Dir.mkdir util_inst_bindir
     @spec.add_dependency 'b', '> 5'
     util_setup_gem
     @installer.ignore_dependencies = true
@@ -635,32 +674,54 @@ load 'my_exec'
                                  "#{@spec.full_name}.gemspec"))
   end
 
-  def test_install_with_message
-    @spec.post_install_message = 'I am a shiny gem!'
+  unless win_platform? # File.chmod doesn't work
+    def test_install_user_local_fallback
+      Dir.mkdir util_inst_bindir
+      File.chmod 0755, @userhome
+      File.chmod 0000, util_inst_bindir
+      File.chmod 0000, Gem.dir
+      @spec.executables = ["executable"]
 
-    use_ui @ui do
-      Dir.chdir @tempdir do Gem::Builder.new(@spec).build end
+      use_ui @ui do
+        util_setup_gem
+        @installer.install
+      end
 
-      @installer.install
+      assert File.exist?(File.join(Gem.user_dir, 'gems',
+                                   @spec.full_name, 'lib', 'code.rb'))
+      assert File.exist?(File.join(Gem.user_dir, 'bin', 'executable'))
+    ensure
+      File.chmod 0755, Gem.dir
+      File.chmod 0755, util_inst_bindir
     end
 
-    assert_match %r|I am a shiny gem!|, @ui.output
+    def test_install_bindir_read_only
+      Dir.mkdir util_inst_bindir
+      File.chmod 0755, @userhome
+      File.chmod 0000, util_inst_bindir
+
+      use_ui @ui do
+        setup
+        util_setup_gem
+        @installer.install
+      end
+
+      assert File.exist?(File.join(Gem.user_dir, 'bin', 'executable'))
+    ensure
+      File.chmod 0755, util_inst_bindir
+    end
   end
 
-  def test_install_writable
-    util_setup_gem
+  def test_install_with_message
+    @spec.post_install_message = 'I am a shiny gem!'
 
-    orig_mode = File.stat(Gem.dir).mode
-    File.chmod 0000, Gem.dir
+    use_ui @ui do
+      Dir.chdir @tempdir do Gem::Builder.new(@spec).build end
 
-    e = assert_raise Gem::FilePermissionError do
       @installer.install
     end
 
-    assert_equal "You don't have write permissions into the #{@gemhome} directory.",
-                 e.message
-  ensure
-    File.chmod orig_mode, Gem.dir
+    assert_match %r|I am a shiny gem!|, @ui.output
   end
 
   def test_install_wrong_ruby_version
diff -pruN 1.2.0-2/test/test_gem_install_update_options.rb 1.3.0~RC1-0ubuntu1/test/test_gem_install_update_options.rb
--- 1.2.0-2/test/test_gem_install_update_options.rb	2007-12-12 23:10:17.000000000 +0000
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_install_update_options.rb	2008-08-27 17:30:05.000000000 +0100
@@ -1,20 +1,21 @@
 require 'test/unit'
 require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
+require File.join(File.expand_path(File.dirname(__FILE__)),
+                  'gem_installer_test_case')
 require 'rubygems/install_update_options'
 require 'rubygems/command'
 
-class TestGemInstallUpdateOptions < RubyGemTestCase
+class TestGemInstallUpdateOptions < GemInstallerTestCase
 
   def setup
     super
 
     @cmd = Gem::Command.new 'dummy', 'dummy'
     @cmd.extend Gem::InstallUpdateOptions
+    @cmd.add_install_update_options
   end
 
   def test_add_install_update_options
-    @cmd.add_install_update_options
-
     args = %w[-i /install_to --rdoc --ri -E -f -t -w -P HighSecurity
               --ignore-dependencies --format-exec --include-dependencies]
 
@@ -22,8 +23,6 @@ class TestGemInstallUpdateOptions < Ruby
   end
 
   def test_security_policy
-    @cmd.add_install_update_options
-
     @cmd.handle_options %w[-P HighSecurity]
 
     assert_equal Gem::Security::HighSecurity, @cmd.options[:security_policy]
@@ -37,4 +36,26 @@ class TestGemInstallUpdateOptions < Ruby
     end
   end
 
+  def test_user_install_enabled
+    @cmd.handle_options %w[--user-install]
+
+    @installer = Gem::Installer.new @gem, @cmd.options
+    @installer.install
+    assert File.exist?(File.join(Gem.user_dir, 'gems'))
+    assert File.exist?(File.join(Gem.user_dir, 'gems',
+                                 @spec.full_name))
+  end
+
+  def test_user_install_disabled_read_only
+    @cmd.handle_options %w[--no-user-install]
+
+    File.chmod 0755, @userhome
+    FileUtils.chmod 0000, @gemhome
+
+    assert_raises(Gem::FilePermissionError) do
+      @installer = Gem::Installer.new @gem, @cmd.options
+    end
+  ensure
+    FileUtils.chmod 0755, @gemhome
+  end
 end
diff -pruN 1.2.0-2/test/test_gem_local_remote_options.rb 1.3.0~RC1-0ubuntu1/test/test_gem_local_remote_options.rb
--- 1.2.0-2/test/test_gem_local_remote_options.rb	2008-06-05 21:55:48.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_local_remote_options.rb	2008-08-27 17:30:05.000000000 +0100
@@ -19,6 +19,18 @@ class TestGemLocalRemoteOptions < RubyGe
     assert @cmd.handles?(args)
   end
 
+  def test_both_eh
+    assert_equal false, @cmd.both?
+
+    @cmd.options[:domain] = :local
+
+    assert_equal false, @cmd.both?
+
+    @cmd.options[:domain] = :both
+
+    assert_equal true, @cmd.both?
+  end
+
   def test_local_eh
     assert_equal false, @cmd.local?
 
diff -pruN 1.2.0-2/test/test_gem_platform.rb 1.3.0~RC1-0ubuntu1/test/test_gem_platform.rb
--- 1.2.0-2/test/test_gem_platform.rb	2007-12-20 00:01:15.000000000 +0000
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_platform.rb	2008-08-27 17:30:05.000000000 +0100
@@ -5,19 +5,6 @@ require 'rbconfig'
 
 class TestGemPlatform < RubyGemTestCase
 
-  def test_self_const_missing
-    consts = [:DARWIN, :LINUX_586, :MSWIN32, :PPC_DARWIN, :WIN32, :X86_LINUX]
-
-    consts.each do |const|
-      e = assert_raise NameError do
-        Gem::Platform.const_missing const
-      end
-
-      assert_equal "#{const} has been removed, use CURRENT instead",
-                   e.message
-    end
-  end
-
   def test_self_local
     util_set_arch 'i686-darwin8.10.1'
 
diff -pruN 1.2.0-2/test/test_gem.rb 1.3.0~RC1-0ubuntu1/test/test_gem.rb
--- 1.2.0-2/test/test_gem.rb	2008-06-18 22:27:03.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem.rb	2008-08-27 17:30:05.000000000 +0100
@@ -44,7 +44,12 @@ class TestGem < RubyGemTestCase
 
   def test_self_bindir_default_dir
     default = Gem.default_dir
-    bindir = (defined? RUBY_FRAMEWORK_VERSION) ? '/usr/bin' : Config::CONFIG['bindir']    
+    bindir = if defined?(RUBY_FRAMEWORK_VERSION) then
+               '/usr/bin'
+             else
+               Config::CONFIG['bindir']
+             end
+
     assert_equal bindir, Gem.bindir(default)
     assert_equal bindir, Gem.bindir(Pathname.new(default))
   end
@@ -217,6 +222,36 @@ class TestGem < RubyGemTestCase
     Gem.ssl_available = orig_Gem_ssl_available
   end
 
+  def test_self_find_files
+    foo1 = quick_gem 'foo', '1' do |s|
+      s.files << 'lib/foo/discover.rb'
+    end
+
+    foo2 = quick_gem 'foo', '2' do |s|
+      s.files << 'lib/foo/discover.rb'
+    end
+
+    path = File.join 'gems', foo1.full_name, 'lib', 'foo', 'discover.rb'
+    write_file(path) { |fp| fp.puts "# #{path}" }
+
+    path = File.join 'gems', foo2.full_name, 'lib', 'foo', 'discover.rb'
+    write_file(path) { |fp| fp.puts "# #{path}" }
+
+    @fetcher = Gem::FakeFetcher.new
+    Gem::RemoteFetcher.fetcher = @fetcher
+
+    Gem.source_index = util_setup_spec_fetcher foo1, foo2
+
+    Gem.searcher = nil
+
+    expected = [
+      File.join(foo1.full_gem_path, 'lib', 'foo', 'discover.rb'),
+      File.join(foo2.full_gem_path, 'lib', 'foo', 'discover.rb'),
+    ]
+
+    assert_equal expected, Gem.find_files('foo/discover').sort
+  end
+
   def test_self_latest_load_paths
     util_make_gems
 
@@ -279,16 +314,16 @@ class TestGem < RubyGemTestCase
   end
 
   def test_self_path_ENV_PATH
-    Gem.clear_paths
+    Gem.send :set_paths, nil
     path_count = Gem.path.size
-    path_count -= 1 if defined? APPLE_GEM_HOME
     Gem.clear_paths
-    util_ensure_gem_dirs
 
     ENV['GEM_PATH'] = @additional.join(File::PATH_SEPARATOR)
 
     assert_equal @additional, Gem.path[0,2]
-    assert_equal path_count + @additional.size, Gem.path.size
+
+    assert_equal path_count + @additional.size, Gem.path.size,
+                 "extra path components: #{Gem.path[2..-1].inspect}"
     assert_match Gem.dir, Gem.path.last
   end
 
@@ -337,6 +372,7 @@ class TestGem < RubyGemTestCase
 
     file_name = File.expand_path __FILE__
     prefix = File.dirname File.dirname(file_name)
+    prefix = File.dirname prefix if File.basename(prefix) == 'test'
 
     Gem::ConfigMap[:libdir] = prefix
 
@@ -350,6 +386,7 @@ class TestGem < RubyGemTestCase
 
     file_name = File.expand_path __FILE__
     prefix = File.dirname File.dirname(file_name)
+    prefix = File.dirname prefix if File.basename(prefix) == 'test'
 
     Gem::ConfigMap[:sitelibdir] = prefix
 
@@ -386,6 +423,44 @@ class TestGem < RubyGemTestCase
                  Gem.required_location("a", "code.rb", "= 2")
   end
 
+  def test_self_ruby_escaping_spaces_in_path
+    orig_ruby = Gem.ruby
+    orig_bindir = Gem::ConfigMap[:bindir]
+    orig_ruby_install_name = Gem::ConfigMap[:ruby_install_name]
+    orig_exe_ext = Gem::ConfigMap[:EXEEXT]
+
+    Gem::ConfigMap[:bindir] = "C:/Ruby 1.8/bin"
+    Gem::ConfigMap[:ruby_install_name] = "ruby"
+    Gem::ConfigMap[:EXEEXT] = ".exe"
+    Gem.instance_variable_set("@ruby", nil)
+
+    assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
+  ensure
+    Gem.instance_variable_set("@ruby", orig_ruby)
+    Gem::ConfigMap[:bindir] = orig_bindir
+    Gem::ConfigMap[:ruby_install_name] = orig_ruby_install_name
+    Gem::ConfigMap[:EXEEXT] = orig_exe_ext
+  end
+
+  def test_self_ruby_path_without_spaces
+    orig_ruby = Gem.ruby
+    orig_bindir = Gem::ConfigMap[:bindir]
+    orig_ruby_install_name = Gem::ConfigMap[:ruby_install_name]
+    orig_exe_ext = Gem::ConfigMap[:EXEEXT]
+
+    Gem::ConfigMap[:bindir] = "C:/Ruby18/bin"
+    Gem::ConfigMap[:ruby_install_name] = "ruby"
+    Gem::ConfigMap[:EXEEXT] = ".exe"
+    Gem.instance_variable_set("@ruby", nil)
+
+    assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
+  ensure
+    Gem.instance_variable_set("@ruby", orig_ruby)
+    Gem::ConfigMap[:bindir] = orig_bindir
+    Gem::ConfigMap[:ruby_install_name] = orig_ruby_install_name
+    Gem::ConfigMap[:EXEEXT] = orig_exe_ext
+  end
+
   def test_self_ruby_version
     version = RUBY_VERSION.dup
     version << ".#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
@@ -426,6 +501,11 @@ class TestGem < RubyGemTestCase
     assert_equal @additional + [Gem.dir], Gem.path
   end
 
+  def test_self_user_dir
+    assert_equal File.join(@userhome, '.gem', Gem.ruby_engine,
+                           Gem::ConfigMap[:ruby_version]), Gem.user_dir
+  end
+
   def test_self_user_home
     if ENV['HOME'] then
       assert_equal ENV['HOME'], Gem.user_home
@@ -434,6 +514,27 @@ class TestGem < RubyGemTestCase
     end
   end
 
+
+  def test_self_user_home_user_drive_and_path
+    # safe-keep env variables
+    orig_home, orig_user_profile = ENV['HOME'], ENV['USERPROFILE']
+    orig_user_drive, orig_user_path = ENV['HOMEDRIVE'], ENV['HOMEPATH']
+
+    # prepare the environment
+    ENV.delete('HOME')
+    ENV.delete('USERPROFILE')
+    ENV['HOMEDRIVE'] = 'Z:'
+    ENV['HOMEPATH'] = '\\Users\\RubyUser'
+
+    assert_equal "Z:\\Users\\RubyUser", Gem.user_home
+
+  ensure
+    ENV['HOME'] = orig_home
+    ENV['USERPROFILE'] = orig_user_profile
+    ENV['USERDRIVE'] = orig_user_drive
+    ENV['USERPATH'] = orig_user_path
+  end
+
   def util_ensure_gem_dirs
     Gem.ensure_gem_subdirectories @gemhome
     @additional.each do |dir|
diff -pruN 1.2.0-2/test/test_gem_remote_fetcher.rb 1.3.0~RC1-0ubuntu1/test/test_gem_remote_fetcher.rb
--- 1.2.0-2/test/test_gem_remote_fetcher.rb	2008-06-06 02:39:33.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_remote_fetcher.rb	2008-08-27 17:30:05.000000000 +0100
@@ -10,6 +10,7 @@ require File.join(File.expand_path(File.
 require 'webrick'
 require 'zlib'
 require 'rubygems/remote_fetcher'
+require 'ostruct'
 
 # = Testing Proxy Settings
 #
@@ -106,6 +107,8 @@ gems:
     @a1, @a1_gem = util_gem 'a', '1' do |s| s.executables << 'a_bin' end
 
     Gem::RemoteFetcher.fetcher = nil
+
+    @fetcher = Gem::RemoteFetcher.fetcher
   end
 
   def test_self_fetcher
@@ -117,7 +120,10 @@ gems:
   def test_self_fetcher_with_proxy
     proxy_uri = 'http://proxy.example.com'
     Gem.configuration[:http_proxy] = proxy_uri
+    Gem::RemoteFetcher.fetcher = nil
+
     fetcher = Gem::RemoteFetcher.fetcher
+
     assert_not_nil fetcher
     assert_kind_of Gem::RemoteFetcher, fetcher
     assert_equal proxy_uri, fetcher.instance_variable_get(:@proxy_uri).to_s
@@ -145,7 +151,7 @@ gems:
   def test_fetch_size_socket_error
     fetcher = Gem::RemoteFetcher.new nil
     def fetcher.connection_for(uri)
-      raise SocketError
+      raise SocketError, "tarded"
     end
 
     uri = 'http://gems.example.com/yaml'
@@ -153,15 +159,13 @@ gems:
       fetcher.fetch_size uri
     end
 
-    assert_equal "SocketError (SocketError)\n\tfetching size (#{uri})",
-                 e.message
+    assert_equal "SocketError: tarded (#{uri})", e.message
   end
 
   def test_no_proxy
     use_ui @ui do
-      fetcher = Gem::RemoteFetcher.new nil
-      assert_data_from_server fetcher.fetch_path(@server_uri)
-      assert_equal SERVER_DATA.size, fetcher.fetch_size(@server_uri)
+      assert_data_from_server @fetcher.fetch_path(@server_uri)
+      assert_equal SERVER_DATA.size, @fetcher.fetch_size(@server_uri)
     end
   end
 
@@ -238,6 +242,7 @@ gems:
     install_dir = File.join @tempdir, 'more_gems'
 
     a1_cache_gem = File.join install_dir, 'cache', "#{@a1.full_name}.gem"
+    FileUtils.mkdir_p(File.dirname(a1_cache_gem))
     actual = fetcher.download(@a1, 'http://gems.example.com', install_dir)
 
     assert_equal a1_cache_gem, actual
@@ -247,7 +252,7 @@ gems:
     assert File.exist?(a1_cache_gem)
   end
 
-  unless win_platform? then # File.chmod doesn't work
+  unless win_platform? # File.chmod doesn't work
     def test_download_local_read_only
       FileUtils.mv @a1_gem, @tempdir
       local_path = File.join @tempdir, "#{@a1.full_name}.gem"
@@ -263,6 +268,19 @@ gems:
     ensure
       File.chmod 0755, File.join(@gemhome, 'cache')
     end
+
+    def test_download_read_only
+      File.chmod 0555, File.join(@gemhome, 'cache')
+      File.chmod 0555, File.join(@gemhome)
+
+      fetcher = util_fuck_with_fetcher File.read(@a1_gem)
+      fetcher.download(@a1, 'http://gems.example.com')
+      assert File.exist?(File.join(Gem.user_dir, 'cache',
+                                   "#{@a1.full_name}.gem"))
+    ensure
+      File.chmod 0755, File.join(@gemhome)
+      File.chmod 0755, File.join(@gemhome, 'cache')
+    end
   end
 
   def test_download_platform_legacy
@@ -363,10 +381,32 @@ gems:
     end
   end
 
+  def test_fetch_path_gzip
+    fetcher = Gem::RemoteFetcher.new nil
+
+    def fetcher.open_uri_or_path(uri, mtime, head = nil)
+      Gem.gzip 'foo'
+    end
+
+    assert_equal 'foo', fetcher.fetch_path(@uri + 'foo.gz')
+  end
+
+  def test_fetch_path_gzip_unmodified
+    fetcher = Gem::RemoteFetcher.new nil
+
+    def fetcher.open_uri_or_path(uri, mtime, head = nil)
+      nil
+    end
+
+    assert_equal nil, fetcher.fetch_path(@uri + 'foo.gz', Time.at(0))
+  end
+
   def test_fetch_path_io_error
     fetcher = Gem::RemoteFetcher.new nil
 
-    def fetcher.open_uri_or_path(uri) raise EOFError; end
+    def fetcher.open_uri_or_path(uri, mtime, head = nil)
+      raise EOFError
+    end
 
     e = assert_raise Gem::RemoteFetcher::FetchError do
       fetcher.fetch_path 'uri'
@@ -379,7 +419,9 @@ gems:
   def test_fetch_path_socket_error
     fetcher = Gem::RemoteFetcher.new nil
 
-    def fetcher.open_uri_or_path(uri) raise SocketError; end
+    def fetcher.open_uri_or_path(uri, mtime, head = nil)
+      raise SocketError
+    end
 
     e = assert_raise Gem::RemoteFetcher::FetchError do
       fetcher.fetch_path 'uri'
@@ -392,7 +434,7 @@ gems:
   def test_fetch_path_system_call_error
     fetcher = Gem::RemoteFetcher.new nil
 
-    def fetcher.open_uri_or_path(uri);
+    def fetcher.open_uri_or_path(uri, mtime = nil, head = nil)
       raise Errno::ECONNREFUSED, 'connect(2)'
     end
 
@@ -405,6 +447,16 @@ gems:
     assert_equal 'uri', e.uri
   end
 
+  def test_fetch_path_unmodified
+    fetcher = Gem::RemoteFetcher.new nil
+
+    def fetcher.open_uri_or_path(uri, mtime, head = nil)
+      nil
+    end
+
+    assert_equal nil, fetcher.fetch_path(URI.parse(@gem_repo), Time.at(0))
+  end
+
   def test_get_proxy_from_env_empty
     orig_env_HTTP_PROXY = ENV['HTTP_PROXY']
     orig_env_http_proxy = ENV['http_proxy']
@@ -462,7 +514,7 @@ gems:
     def conn.request(req)
       unless defined? @requested then
         @requested = true
-        res = Net::HTTPRedirection.new nil, 301, nil
+        res = Net::HTTPMovedPermanently.new nil, 301, nil
         res.add_field 'Location', 'http://gems.example.com/real_path'
         res
       else
@@ -475,9 +527,9 @@ gems:
     conn = { 'gems.example.com:80' => conn }
     fetcher.instance_variable_set :@connections, conn
 
-    fetcher.send :open_uri_or_path, 'http://gems.example.com/redirect' do |io|
-      assert_equal 'real_path', io.read
-    end
+    data = fetcher.open_uri_or_path 'http://gems.example.com/redirect'
+
+    assert_equal 'real_path', data
   end
 
   def test_open_uri_or_path_limited_redirects
@@ -486,7 +538,7 @@ gems:
     conn = Object.new
     def conn.started?() true end
     def conn.request(req)
-      res = Net::HTTPRedirection.new nil, 301, nil
+      res = Net::HTTPMovedPermanently.new nil, 301, nil
       res.add_field 'Location', 'http://gems.example.com/redirect'
       res
     end
@@ -495,29 +547,43 @@ gems:
     fetcher.instance_variable_set :@connections, conn
 
     e = assert_raise Gem::RemoteFetcher::FetchError do
-      fetcher.send :open_uri_or_path, 'http://gems.example.com/redirect'
+      fetcher.open_uri_or_path 'http://gems.example.com/redirect'
     end
 
     assert_equal 'too many redirects (http://gems.example.com/redirect)',
                  e.message
   end
 
-  def test_zip
-    use_ui @ui do
-      self.class.enable_zip = true
-      fetcher = Gem::RemoteFetcher.new nil
-      assert_equal SERVER_DATA.size, fetcher.fetch_size(@server_uri), "probably not from proxy"
-      zip_data = fetcher.fetch_path(@server_z_uri)
-      assert zip_data.size < SERVER_DATA.size, "Zipped data should be smaller"
-    end
+  def test_request
+    uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}"
+    util_stub_connection_for :body => :junk, :code => 200
+
+    response = @fetcher.request uri, Net::HTTP::Get
+
+    assert_equal 200, response.code
+    assert_equal :junk, response.body
   end
 
-  def test_no_zip
-    use_ui @ui do
-      self.class.enable_zip = false
-      fetcher = Gem::RemoteFetcher.new nil
-      assert_error { fetcher.fetch_path(@server_z_uri) }
-    end
+  def test_request_head
+    uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}"
+    util_stub_connection_for :body => '', :code => 200
+    response = @fetcher.request uri, Net::HTTP::Head
+
+    assert_equal 200, response.code
+    assert_equal '', response.body
+  end
+
+  def test_request_unmodifed
+    uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}"
+    conn = util_stub_connection_for :body => '', :code => 304
+
+    t = Time.now
+    response = @fetcher.request uri, Net::HTTP::Head, t
+
+    assert_equal 304, response.code
+    assert_equal '', response.body
+
+    assert_equal t.rfc2822, conn.payload['if-modified-since']
   end
 
   def test_yaml_error_on_size
@@ -528,7 +594,17 @@ gems:
     end
   end
 
-  private
+  def util_stub_connection_for hash
+    def @fetcher.connection= conn
+      @conn = conn
+    end
+
+    def @fetcher.connection_for uri
+      @conn
+    end
+
+    @fetcher.connection = Conn.new OpenStruct.new(hash)
+  end
 
   def assert_error(exception_class=Exception)
     got_exception = false
@@ -548,6 +624,20 @@ gems:
     assert_block("Data is not from proxy") { data =~ /0\.4\.2/ }
   end
 
+  class Conn
+    attr_accessor :payload
+
+    def initialize(response)
+      @response = response
+      self.payload = nil
+    end
+
+    def request(req)
+      self.payload = req
+      @response
+    end
+  end
+
   class NilLog < WEBrick::Log
     def log(level, data) #Do nothing
     end
diff -pruN 1.2.0-2/test/test_gem_source_index.rb 1.3.0~RC1-0ubuntu1/test/test_gem_source_index.rb
--- 1.2.0-2/test/test_gem_source_index.rb	2008-06-18 00:02:26.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_source_index.rb	2008-08-27 17:30:05.000000000 +0100
@@ -437,6 +437,27 @@ WARNING:  Invalid .gemspec format in '#{
     assert_equal [], missing
   end
 
+  def test_find_name
+    assert_equal [@a1, @a2], @source_index.find_name('a')
+    assert_equal [@a2], @source_index.find_name('a', '= 2')
+    assert_equal [], @source_index.find_name('bogusstring')
+    assert_equal [], @source_index.find_name('a', '= 3')
+
+    source_index = Gem::SourceIndex.new
+    source_index.add_spec @a1
+    source_index.add_spec @a2
+
+    assert_equal [@a1], source_index.find_name(@a1.name, '= 1')
+
+    r1 = Gem::Requirement.create '= 1'
+    assert_equal [@a1], source_index.find_name(@a1.name, r1)
+  end
+
+  def test_find_name_empty_cache
+    empty_source_index = Gem::SourceIndex.new({})
+    assert_equal [], empty_source_index.find_name("foo")
+  end
+
   def test_latest_specs
     p1_ruby = quick_gem 'p', '1'
     p1_platform = quick_gem 'p', '1' do |spec|
@@ -573,28 +594,12 @@ WARNING:  Invalid .gemspec format in '#{
   end
 
   def test_search
-    assert_equal [@a1, @a2, @a_evil9], @source_index.search('a')
-    assert_equal [@a2], @source_index.search('a', '= 2')
+    requirement = Gem::Requirement.create '= 9'
+    with_version = Gem::Dependency.new(/^a/, requirement)
+    assert_equal [@a_evil9], @source_index.search(with_version)
 
-    assert_equal [], @source_index.search('bogusstring')
-    assert_equal [], @source_index.search('a', '= 3')
-
-    source_index = Gem::SourceIndex.new
-    source_index.add_spec @a1
-    source_index.add_spec @a2
-
-    assert_equal [@a1], source_index.search(@a1.name, '= 1')
-
-    r1 = Gem::Requirement.create '= 1'
-    assert_equal [@a1], source_index.search(@a1.name, r1)
-
-    dep = Gem::Dependency.new @a1.name, r1
-    assert_equal [@a1], source_index.search(dep)
-  end
-
-  def test_search_empty_cache
-    empty_source_index = Gem::SourceIndex.new({})
-    assert_equal [], empty_source_index.search("foo")
+    with_default = Gem::Dependency.new(/^a/, Gem::Requirement.default)
+    assert_equal [@a1, @a2, @a_evil9], @source_index.search(with_default)
   end
 
   def test_search_platform
diff -pruN 1.2.0-2/test/test_gem_source_info_cache.rb 1.3.0~RC1-0ubuntu1/test/test_gem_source_info_cache.rb
--- 1.2.0-2/test/test_gem_source_info_cache.rb	2008-06-19 00:06:03.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_source_info_cache.rb	2008-08-27 17:30:05.000000000 +0100
@@ -224,7 +224,8 @@ class TestGemSourceInfoCache < RubyGemTe
 
     @sic.set_cache_data @gem_repo => sice
     latest = @sic.latest_cache_data
-    gems = latest[@gem_repo].source_index.search('a').map { |s| s.full_name }
+    beginning_with_a = Gem::Dependency.new(/^a/, Gem::Requirement.default)
+    gems = latest[@gem_repo].source_index.search(beginning_with_a).map { |s| s.full_name }
 
     assert_equal %w[a-2 a_evil-9], gems
   end
diff -pruN 1.2.0-2/test/test_gem_spec_fetcher.rb 1.3.0~RC1-0ubuntu1/test/test_gem_spec_fetcher.rb
--- 1.2.0-2/test/test_gem_spec_fetcher.rb	2008-06-19 00:05:44.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_spec_fetcher.rb	2008-08-27 17:30:05.000000000 +0100
@@ -67,7 +67,7 @@ class TestGemSpecFetcher < RubyGemTestCa
   end
 
   def test_fetch_legacy_repo
-    @fetcher.data["#{@gem_repo}specs.#{Gem.marshal_version}.gz"] = nil
+    @fetcher.data.delete "#{@gem_repo}specs.#{Gem.marshal_version}.gz"
     @fetcher.data["#{@gem_repo}yaml"] = ''
     util_setup_source_info_cache @a1, @a2
 
@@ -259,6 +259,16 @@ RubyGems will revert to legacy indexes d
     assert_equal specs, cached_specs
   end
 
+  def test_list_latest_all
+    specs = @sf.list false
+
+    assert_equal [@latest_specs], specs.values
+
+    specs = @sf.list true
+
+    assert_equal [@specs], specs.values, 'specs file not loaded'
+  end
+
   def test_load_specs
     specs = @sf.load_specs @uri, 'specs'
 
@@ -294,9 +304,9 @@ RubyGems will revert to legacy indexes d
       Marshal.dump @latest_specs, io
     end
 
-    specs = @sf.load_specs @uri, 'specs'
+    latest_specs = @sf.load_specs @uri, 'latest_specs'
 
-    assert_equal @specs, specs
+    assert_equal @latest_specs, latest_specs
   end
 
 end
diff -pruN 1.2.0-2/test/test_gem_specification.rb 1.3.0~RC1-0ubuntu1/test/test_gem_specification.rb
--- 1.2.0-2/test/test_gem_specification.rb	2008-06-21 22:52:25.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_specification.rb	2008-08-27 17:30:05.000000000 +0100
@@ -500,7 +500,7 @@ end
   end
 
   def test_has_rdoc_eh
-    assert_equal true, @a1.has_rdoc?
+    assert @a1.has_rdoc?
   end
 
   def test_hash
@@ -654,7 +654,7 @@ end
     current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
     s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
 
-    if current_version >= 3 then
+    if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
       s.add_runtime_dependency(%q<b>, [\"= 1\"])
     else
       s.add_dependency(%q<b>, [\"= 1\"])
@@ -706,7 +706,7 @@ end
     current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
     s.specification_version = 2
 
-    if current_version >= 3 then
+    if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
       s.add_runtime_dependency(%q<rake>, [\"> 0.4\"])
       s.add_runtime_dependency(%q<jabber4r>, [\"> 0.0.0\"])
       s.add_runtime_dependency(%q<pqa>, [\"> 0.4\", \"<= 0.6\"])
diff -pruN 1.2.0-2/test/test_gem_uninstaller.rb 1.3.0~RC1-0ubuntu1/test/test_gem_uninstaller.rb
--- 1.2.0-2/test/test_gem_uninstaller.rb	2008-06-17 22:41:19.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/test/test_gem_uninstaller.rb	2008-08-27 17:30:05.000000000 +0100
@@ -60,5 +60,26 @@ class TestGemUninstaller < GemInstallerT
     assert_equal true, uninstaller.path_ok?(@spec)
   end
 
+  def test_uninstall
+    uninstaller = Gem::Uninstaller.new @spec.name, :executables => true
+
+    gem_dir = File.join @gemhome, 'gems', @spec.full_name
+
+    Gem.pre_uninstall do
+      assert File.exist?(gem_dir), 'gem_dir should exist'
+    end
+
+    Gem.post_uninstall do
+      assert !File.exist?(gem_dir), 'gem_dir should not exist'
+    end
+
+    uninstaller.uninstall
+
+    assert !File.exist?(gem_dir)
+
+    assert_same uninstaller, @pre_uninstall_hook_arg
+    assert_same uninstaller, @post_uninstall_hook_arg
+  end
+
 end
 
diff -pruN 1.2.0-2/util/CL2notes 1.3.0~RC1-0ubuntu1/util/CL2notes
--- 1.2.0-2/util/CL2notes	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/util/CL2notes	2008-08-27 17:30:06.000000000 +0100
@@ -0,0 +1,56 @@
+#!/usr/bin/env ruby
+
+$:.unshift 'lib'
+
+require 'rubygems'
+
+def format_text(text, wrap, indent=0)
+  result = []
+  work = text.dup
+
+  while work.length > wrap
+    if work =~ /^(.{0,#{wrap}})[ \n]/o then
+      result << $1
+      work.slice!(0, $&.length)
+    else
+      result << work.slice!(0, wrap)
+    end
+  end
+
+  result << work if work.length.nonzero?
+  result.join("\n").gsub(/^/, " " * indent)
+end
+
+version = Gem::RubyGemsVersion
+
+entries = Hash.new { |h,file| h[file] = [] }
+entry = []
+file = nil
+
+IO.foreach 'ChangeLog' do |line|
+  case line
+  when /^\s*$/,
+       /^#/,
+       /^\d{4}-\d{2}-\d{2}/ then
+    next
+  when /^\s+\*\s+([^:]+?):\s+#{version}/ then
+    entries[file] << entry.join(' ') unless entry.empty?
+    break
+  when /^\s+\*\s+([^:]+?):\s+/ then
+    entries[file] << entry.join(' ') unless entry.empty?
+    file = $1
+    entry = [$'.strip]
+  when /^\s+/ then
+    entry << $'.strip
+  end
+end
+
+entries.sort_by { |file, | file }.each do |file, file_entries|
+  puts "* #{file}"
+  file_entries.each do |file_entry|
+    file_entry = format_text file_entry, 74, 4
+    file_entry.sub! '    ', '  * '
+    puts file_entry
+  end
+end
+
diff -pruN 1.2.0-2/util/gem_prelude.rb 1.3.0~RC1-0ubuntu1/util/gem_prelude.rb
--- 1.2.0-2/util/gem_prelude.rb	1970-01-01 01:00:00.000000000 +0100
+++ 1.3.0~RC1-0ubuntu1/util/gem_prelude.rb	2008-08-27 17:30:06.000000000 +0100
@@ -0,0 +1,212 @@
+# depends on: array.rb dir.rb env.rb file.rb hash.rb module.rb regexp.rb
+
+if defined?(Gem) then
+
+  module Kernel
+
+    def gem(gem_name, *version_requirements)
+      Gem.push_gem_version_on_load_path(gem_name, *version_requirements)
+    end
+
+  end
+
+  module Gem
+
+    ConfigMap = {
+      :sitedir => RbConfig::CONFIG["sitedir"],
+      :ruby_version => RbConfig::CONFIG["ruby_version"],
+      :libdir => RbConfig::CONFIG["libdir"],
+      :sitelibdir => RbConfig::CONFIG["sitelibdir"],
+      :arch => RbConfig::CONFIG["arch"],
+      :bindir => RbConfig::CONFIG["bindir"],
+      :EXEEXT => RbConfig::CONFIG["EXEEXT"],
+      :RUBY_SO_NAME => RbConfig::CONFIG["RUBY_SO_NAME"],
+      :ruby_install_name => RbConfig::CONFIG["ruby_install_name"]
+    }
+
+    def self.default_dir
+      if defined? RUBY_FRAMEWORK_VERSION
+        return File.join(File.dirname(ConfigMap[:sitedir]), "Gems")
+      else
+        File.join(ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version])
+      end
+    end
+
+    def self.dir
+      @gem_home ||= nil
+      set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
+      @gem_home
+    end
+
+    def self.path
+      @gem_path ||= nil
+      unless @gem_path
+        paths = [ENV['GEM_PATH']]
+        paths << APPLE_GEM_HOME if defined? APPLE_GEM_HOME
+        set_paths(paths.compact.join(File::PATH_SEPARATOR))
+      end
+      @gem_path
+    end
+
+    # Set the Gem home directory (as reported by +dir+).
+    def self.set_home(home)
+      @gem_home = home
+      ensure_gem_subdirectories(@gem_home)
+    end
+
+    def self.set_paths(gpaths)
+      if gpaths
+        @gem_path = gpaths.split(File::PATH_SEPARATOR)
+        @gem_path << Gem.dir
+      else
+        @gem_path = [Gem.dir]
+      end
+      @gem_path.uniq!
+      @gem_path.each do |gp| ensure_gem_subdirectories(gp) end
+    end
+
+    def self.ensure_gem_subdirectories(path)
+    end
+
+    GEM_PRELUDE_METHODS = Gem.methods(false)
+
+    module QuickLoader
+
+      def self.load_full_rubygems_library
+        class << Gem
+          Gem::GEM_PRELUDE_METHODS.each do |method_name|
+            undef_method method_name
+          end
+        end
+
+        Kernel.module_eval do
+          undef_method :gem if method_defined? :gem
+        end
+
+        $".delete File.join(Gem::ConfigMap[:libdir], 'ruby',
+                            Gem::ConfigMap[:ruby_version], 'rubygems.rb')
+
+        require 'rubygems'
+      end
+
+      GemPaths = {}
+      GemVersions = {}
+
+      def push_gem_version_on_load_path(gem_name, *version_requirements)
+        if version_requirements.empty?
+          unless GemPaths.has_key?(gem_name)
+            raise LoadError.new("Could not find RubyGem #{gem_name} (>= 0)\n") 
+          end
+
+          # highest version gems already active
+          return false
+        else
+          if version_requirements.length > 1
+            QuickLoader.load_full_rubygems_library
+            return gem(gem_name, *version_requirements)
+          end
+
+          requirement, version = version_requirements[0].split
+          requirement.strip!
+
+          if requirement == ">" || requirement == ">="
+            if (GemVersions[gem_name] <=> Gem.calculate_integers_for_gem_version(version)) >= 0
+              return false 
+            end
+          elsif requirement == "~>"
+            loaded_version = GemVersions[gem_name]
+            required_version = Gem.calculate_integers_for_gem_version(version)
+            if loaded_version && (loaded_version[0] == required_version[0])
+              return false
+            end
+          end
+
+          QuickLoader.load_full_rubygems_library
+          gem(gem_name, *version_requirements)
+        end
+      end
+
+      def calculate_integers_for_gem_version(gem_version)
+        numbers = gem_version.split(".").collect {|n| n.to_i}
+        numbers.pop while numbers.last == 0
+        numbers << 0 if numbers.empty?
+        numbers
+      end
+
+      def push_all_highest_version_gems_on_load_path
+        Gem.path.each do |path|
+          gems_directory = File.join(path, "gems")
+          if File.exist?(gems_directory)
+            Dir.entries(gems_directory).each do |gem_directory_name|
+              next if gem_directory_name == "." || gem_directory_name == ".."
+              dash = gem_directory_name.rindex("-")
+              next if dash.nil?
+              gem_name = gem_directory_name[0...dash]
+              current_version = GemVersions[gem_name]
+              new_version = calculate_integers_for_gem_version(gem_directory_name[dash+1..-1])
+              if current_version
+                if (current_version <=> new_version) == -1
+                  GemVersions[gem_name] = new_version
+                  GemPaths[gem_name] = File.join(gems_directory, gem_directory_name)
+                end
+              else
+                GemVersions[gem_name] = new_version
+                GemPaths[gem_name] = File.join(gems_directory, gem_directory_name)
+              end
+            end
+          end
+        end
+
+        require_paths = []
+
+        GemPaths.values.each do |path|
+          if File.exist?(File.join(path, ".require_paths"))
+            require_paths.concat(File.read(File.join(path, ".require_paths")).split.map {|require_path| File.join(path, require_path)})
+          else
+            require_paths << File.join(path, "bin") if File.exist?(File.join(path, "bin"))
+            require_paths << File.join(path, "lib") if File.exist?(File.join(path, "lib"))
+          end
+        end
+
+        # "tag" the first require_path inserted into the $LOAD_PATH to enable
+        # indexing correctly with rubygems proper when it inserts an explicitly
+        # gem version
+        unless require_paths.empty?
+          require_paths.first.instance_variable_set(:@gem_prelude_index, true)
+        end
+        # gem directories must come after -I and ENV['RUBYLIB']
+        $:[$:.index(ConfigMap[:sitelibdir]),0] = require_paths
+      end
+
+      def const_missing(constant)
+        QuickLoader.load_full_rubygems_library
+        if Gem.const_defined?(constant)
+          Gem.const_get(constant)
+        else
+          super
+        end
+      end
+
+      def method_missing(method, *args, &block)
+        QuickLoader.load_full_rubygems_library
+        super unless Gem.respond_to?(method)
+        Gem.send(method, *args, &block)
+      end
+    end
+
+    extend QuickLoader
+
+  end
+
+  begin
+    Gem.push_all_highest_version_gems_on_load_path
+    $" << File.join(Gem::ConfigMap[:libdir], "ruby",
+                    Gem::ConfigMap[:ruby_version], "rubygems.rb")
+  rescue Exception => e
+    puts "Error loading gem paths on load path in gem_prelude"
+    puts e
+    puts e.backtrace.join("\n")
+  end
+
+end
+


More information about the Pkg-ruby-extras-maintainers mailing list