--- libgems-ruby-1.3.4.orig/debian/rubygems1.9.prerm
+++ libgems-ruby-1.3.4/debian/rubygems1.9.prerm
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+
+set -e
+
+case "$1" in
+    remove|deconfigure)
+        update-alternatives --quiet --remove gem /usr/bin/gem1.9
+        ;;
+    *)
+esac
+
+#DEBHELPER#
+
+exit 0
--- libgems-ruby-1.3.4.orig/debian/copyright
+++ libgems-ruby-1.3.4/debian/copyright
@@ -0,0 +1,77 @@
+This package was debianized by Daigo Moriwaki <beatles@sgtpepper.net> on
+Sun, 21 Nov 2004 12:23:16 +0900.
+
+It was downloaded from http://rubyforge.org/projects/rubygems
+
+Upstream Authors: 
+
+Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others
+
+License: it can be found at http://rubyforge.org/projects/rubygems.
+
+Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.co.jp>.
+You can redistribute it and/or modify it under either the terms of the GPL
+(see COPYING.txt file), or the conditions below:
+
+  1. You may make and give away verbatim copies of the source form of the
+     software without restriction, provided that you duplicate all of the
+     original copyright notices and associated disclaimers.
+
+  2. You may modify your copy of the software in any way, provided that
+     you do at least ONE of the following:
+
+       a) place your modifications in the Public Domain or otherwise
+          make them Freely Available, such as by posting said
+	  modifications to Usenet or an equivalent medium, or by allowing
+	  the author to include your modifications in the software.
+
+       b) use the modified software only within your corporation or
+          organization.
+
+       c) rename any non-standard executables so the names do not conflict
+	  with standard executables, which must also be provided.
+
+       d) make other distribution arrangements with the author.
+
+  3. You may distribute the software in object code or executable
+     form, provided that you do at least ONE of the following:
+
+       a) distribute the executables and library files of the software,
+	  together with instructions (in the manual page or equivalent)
+	  on where to get the original distribution.
+
+       b) accompany the distribution with the machine-readable source of
+	  the software.
+
+       c) give non-standard executables non-standard names, with
+          instructions on where to get the original software distribution.
+
+       d) make other distribution arrangements with the author.
+
+  4. You may modify and include the part of the software into any other
+     software (possibly commercial).  But some files in the distribution
+     are not written by the author, so that they are not under this terms.
+
+     They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
+     files under the ./missing directory.  See each file for the copying
+     condition.
+
+  5. The scripts and library files supplied as input to or produced as 
+     output from the software do not automatically fall under the
+     copyright of the software, but belong to whomever generated them, 
+     and may be sold commercially, and may be aggregated with this
+     software.
+
+  6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+     IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+     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/patches/22_add_bash_completion.dpatch
+Rubygems bash completion (c) Michael Schuerig, michael@schuerig.de, 2007-02-24
+Free for all uses.
--- libgems-ruby-1.3.4.orig/debian/rubygems1.8.postinst
+++ libgems-ruby-1.3.4/debian/rubygems1.8.postinst
@@ -0,0 +1,21 @@
+#!/bin/sh
+# 
+
+set -e
+
+case "$1" in
+  configure)
+        rm -f /var/lib/gems/1.8/source_cache
+        update-alternatives --quiet --install /usr/bin/gem gem \
+            /usr/bin/gem1.8 180 \
+	    --slave /usr/share/man/man1/gem.1.gz gem.1.gz \
+	    /usr/share/man/man1/gem1.8.1.gz \
+            --slave /etc/bash_completion.d/gem bash_completion_gem \
+            /etc/bash_completion.d/gem1.8
+       ;;
+  *)
+esac
+
+#DEBHELPER#
+
+exit 0
--- libgems-ruby-1.3.4.orig/debian/README.Debian
+++ libgems-ruby-1.3.4/debian/README.Debian
@@ -0,0 +1,20 @@
+Notes for rubygems{1.8|1.9} in Debian
+=====================================
+
+Since some patches are applied to fit Debian FHS, Debian's RubyGems behaves
+a bit differently than the original.
+
+* Directory where gems are to be installed
+
+/var/lib/gems is default in Debian instead of /usr/lib/gems. You can
+override it by defining GEM_HOME environment variable. 
+
+* 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.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Mon, 09 Jun 2008
--- libgems-ruby-1.3.4.orig/debian/gem.in
+++ libgems-ruby-1.3.4/debian/gem.in
@@ -0,0 +1,41 @@
+.TH GEM@@VERSION@@ "1" "Dec 2007" "gem@@VERSION@@ 1.0.0" "User Commands"
+.SH NAME
+gem@@VERSION@@ \- the front end to RubyGems
+.SH SYNOPSIS
+.IP
+gem@@VERSION@@ command [arguments...] [options...]
+.IP
+gem@@VERSION@@ \fB\-h\fR | \-\-help
+.IP
+gem@@VERSION@@ \fB\-v\fR | \-\-version
+.fi
+.SH DESCRIPTION
+.B gem@@VERSION@@
+is the front end to RubyGems, a sophisticated package manager for Ruby. This is a
+basic help message containing pointers to more information.
+.PP
+Further help:
+.TP
+gem@@VERSION@@ help commands
+list all 'gem@@VERSION@@' commands
+.TP
+gem@@VERSION@@ help examples
+show some examples of usage
+.TP
+gem@@VERSION@@ help <COMMAND>
+show help on COMMAND
+.IP
+(e.g. 'gem@@VERSION@@ help install')
+.IP
+.PP
+Further information:
+.IP
+http://rubygems.org/
+.SH EXAMPLES
+.IP
+.nf
+gem@@VERSION@@ install rake
+gem@@VERSION@@ list \fB\-\-local\fR
+gem@@VERSION@@ build package.gemspec
+gem@@VERSION@@ help install
+.fi
--- libgems-ruby-1.3.4.orig/debian/rubygems1.9.postinst
+++ libgems-ruby-1.3.4/debian/rubygems1.9.postinst
@@ -0,0 +1,21 @@
+#!/bin/sh
+# 
+
+set -e
+
+case "$1" in
+  configure)
+        rm -f /var/lib/gems/1.9/source_cache
+        update-alternatives --quiet --install /usr/bin/gem gem \
+            /usr/bin/gem1.9 170 \
+	    --slave /usr/share/man/man1/gem.1.gz gem.1.gz \
+	    /usr/share/man/man1/gem1.9.1.gz \
+            --slave /etc/bash_completion.d/gem bash_completion_gem \
+            /etc/bash_completion.d/gem1.9
+       ;;
+  *)
+esac
+
+#DEBHELPER#
+
+exit 0
--- libgems-ruby-1.3.4.orig/debian/rules
+++ libgems-ruby-1.3.4/debian/rules
@@ -0,0 +1,75 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/dpatch.mk
+
+DEB_INSTALL_CHANGELOGS_ALL = ChangeLog debian/README.Debian
+
+RUBY18 = /usr/bin/ruby1.8
+RUBY19 = /usr/bin/ruby1.9
+RDOC = /usr/bin/rdoc1.8
+RUBY18LIBDIR = $(shell $(RUBY18) -rrbconfig -e "puts Config::CONFIG['rubylibdir']")
+RUBY19LIBDIR = $(shell $(RUBY19) -rrbconfig -e "puts Config::CONFIG['rubylibdir']")
+
+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_MANPAGES_rubygems1.8 += debian/gem1.8.1
+DEB_INSTALL_MANPAGES_rubygems1.9 += debian/gem1.9.1
+
+clean::
+	rm -rf html
+	rm -f debian/gem1.*
+	rm -f debian/etc/bash_completion.d/gem1.*
+
+build/rubygems1.8::
+	$(RUBY18) setup.rb --no-rdoc --no-ri --prefix=$(CURDIR)/debian/$(cdbs_curpkg)
+
+build/rubygems1.9::
+	$(RUBY19) setup.rb --no-rdoc --no-ri --prefix=$(CURDIR)/debian/$(cdbs_curpkg)
+
+build/rubygems-doc::
+	find lib -name "*.rb" | xargs $(RDOC) --fmt html --title RubyGems \
+	  --line-numbers --inline-source --main README -o html README
+
+install/rubygems1.8::
+	find $(CURDIR)/debian/ -type f -name "*.in" | \
+	  while read fname; \
+	  do \
+	    sed -e 's/@@VERSION@@/1\.8/g' -e 's/@@DOTLESS_VERSION@@/18/g' \
+		< $$fname > `expr $$fname : '\(.*\)\.in$$'`1.8; \
+	  done; \
+	  : \
+	done
+	mv $(CURDIR)/debian/gem1.8 $(CURDIR)/debian/gem1.8.1
+	mkdir -p $(CURDIR)/debian/$(cdbs_curpkg)/$(RUBY18LIBDIR)/
+	mkdir -p $(CURDIR)/debian/$(cdbs_curpkg)/usr/bin/
+	mv $(CURDIR)/debian/$(cdbs_curpkg)/lib/* $(CURDIR)/debian/$(cdbs_curpkg)/$(RUBY18LIBDIR)/
+	rm -rf $(CURDIR)/debian/$(cdbs_curpkg)/lib
+	mv $(CURDIR)/debian/$(cdbs_curpkg)/bin/gem1.8 $(CURDIR)/debian/$(cdbs_curpkg)/usr/bin/
+	rm -rf $(CURDIR)/debian/$(cdbs_curpkg)/bin/
+	dh_install -p$(cdbs_curpkg)\
+	  debian/etc/bash_completion.d/gem1.8 etc/bash_completion.d/
+
+install/rubygems1.9::
+	find $(CURDIR)/debian/ -type f -name "*.in" | \
+	  while read fname; \
+	  do \
+	    sed -e 's/@@VERSION@@/1\.9/g' -e 's/@@DOTLESS_VERSION@@/19/g' \
+		< $$fname > `expr $$fname : '\(.*\)\.in$$'`1.9; \
+	  done; \
+	  : \
+	done
+	mv $(CURDIR)/debian/gem1.9 $(CURDIR)/debian/gem1.9.1
+	mkdir -p $(CURDIR)/debian/$(cdbs_curpkg)/$(RUBY19LIBDIR)/
+	mkdir -p $(CURDIR)/debian/$(cdbs_curpkg)/usr/bin/
+	mv $(CURDIR)/debian/$(cdbs_curpkg)/lib/* $(CURDIR)/debian/$(cdbs_curpkg)/$(RUBY19LIBDIR)/
+	rm $(CURDIR)/debian/$(cdbs_curpkg)/$(RUBY19LIBDIR)/rbconfig/datadir.rb
+	rm -rf $(CURDIR)/debian/$(cdbs_curpkg)/lib
+	mv $(CURDIR)/debian/$(cdbs_curpkg)/bin/gem1.9 $(CURDIR)/debian/$(cdbs_curpkg)/usr/bin/
+	rm -rf $(CURDIR)/debian/$(cdbs_curpkg)/bin/
+	dh_install -p$(cdbs_curpkg) \
+	  debian/etc/bash_completion.d/gem1.9 etc/bash_completion.d/
+
--- libgems-ruby-1.3.4.orig/debian/compat
+++ libgems-ruby-1.3.4/debian/compat
@@ -0,0 +1 @@
+7
--- libgems-ruby-1.3.4.orig/debian/rubygems-doc.doc-base
+++ libgems-ruby-1.3.4/debian/rubygems-doc.doc-base
@@ -0,0 +1,10 @@
+Document: rubygems-doc
+Title: RubyGems documentation
+Author: Chad Fowler, Rich Kilmer, Jim Weirich and others
+Abstract: This docuement is genareted from RubyGems' source code and 
+ describes RubyGems' classes and methods
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/rubygems-doc/html/index.html
+Files: /usr/share/doc/rubygems-doc/html/*.html
--- libgems-ruby-1.3.4.orig/debian/control
+++ libgems-ruby-1.3.4/debian/control
@@ -0,0 +1,76 @@
+Source: libgems-ruby
+Section: ruby
+Priority: optional
+Maintainer: Daigo Moriwaki <daigo@debian.org>
+Uploaders: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers@lists.alioth.debian.org>
+Build-Depends: cdbs, dpatch (>= 2.0.10), debhelper (>= 7.0.0), ruby1.8, rdoc1.8, ruby1.9 (>= 1.9.0.1-5), rdoc1.9, ruby-pkg-tools
+Standards-Version: 3.8.1
+Homepage: http://rubygems.org/
+Vcs-Svn: svn://svn.debian.org/svn/pkg-ruby-extras/packages/libgems-ruby
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-ruby-extras/packages/libgems-ruby
+
+Package: rubygems1.8
+Architecture: all
+Depends: ${misc:Depends}, ruby1.8, rdoc1.8
+Suggests: ruby1.8-dev, build-essential, rubygems-doc
+Conflicts: libgems-ruby1.8, rubygems (<= 1.2.0-2) 
+Replaces: libgems-ruby1.8
+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 provides RubyGems with Ruby 1.8.
+
+Package: rubygems1.9
+Architecture: all
+Depends: ${misc:Depends}, ruby1.9 (>= 1.9.0.1-5), rdoc1.9
+Suggests: ruby1.9-dev (>= 1.9.0.1-5), build-essential, rubygems-doc
+Conflicts: gem1.9
+Replaces: gem1.9
+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 provides RubyGems with Ruby 1.9.
+
+Package: rubygems
+Architecture: all
+Depends: ${misc:Depends}, rubygems1.8 (= ${binary:Version})
+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 is a dependency package which depends on Debian's default Ruby version
+ (currently 1.8.x).
+
+Package: rubygems-doc
+Section: doc
+Architecture: all
+Depends: ${misc:Depends} 
+Suggests: www-browse, ruby1.8 | ruby1.9
+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 provides documents of RubyGems, which is available for both 
+ Ruby 1.8 and 1.9.
--- libgems-ruby-1.3.4.orig/debian/changelog
+++ libgems-ruby-1.3.4/debian/changelog
@@ -0,0 +1,306 @@
+libgems-ruby (1.3.4-1~bpo50+1) lenny-backports; urgency=low
+
+  * Backport testing version for backports.org
+
+ -- Micah Anderson <micah@debian.org>  Fri, 26 Jun 2009 15:22:01 +0000
+
+libgems-ruby (1.3.4-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Sun, 14 Jun 2009 17:33:44 +0900
+
+libgems-ruby (1.3.3-1) unstable; urgency=low
+
+  * New upstream release
+  * Gems failed to build a gem package with a gemspec that does not have a
+    homepage attribute. This issue has been fixed by the upstream. 
+    (Closes: #529713)
+
+ -- Daigo Moriwaki <daigo@debian.org>  Thu, 21 May 2009 23:02:55 +0900
+
+libgems-ruby (1.3.2-1) unstable; urgency=low
+
+  [ Daigo Moriwaki ]
+  * New upstream release.
+  * debian/control:
+    - Bumped up the Standards-Version to 3.8.1.
+    - Depend ${misc:Depends} as well.
+  * debian/rules:
+    - Removed a deprecated dependency to a 'TODO' file.
+  * Bumped up the compat level to 7.
+    - debian/compat
+    - debian/control.
+
+  [ Gunnar Wolf ]
+  * Changed section to Ruby as per ftp-masters' request
+
+ -- Daigo Moriwaki <daigo@debian.org>  Tue, 28 Apr 2009 21:18:02 +0900
+
+libgems-ruby (1.3.1-1) experimental; urgency=low
+
+  * New upstream release.
+  * Removed debian/patches/21_avoid_ioseek.dpatch since the upstream checks
+    I/O errors now.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Wed, 19 Nov 2008 00:03:20 +0900
+
+libgems-ruby (1.2.0-3) unstable; urgency=low
+
+  * debian/control:
+    - `rubygems' is present again to provide a dependency
+      package referring to rubygems1.8. 
+    - Bumped up Standards-Version to 3.8.0: used ${binary:Version} instread.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Sun, 31 Aug 2008 23:56:21 +0900
+
+libgems-ruby (1.2.0-2) unstable; urgency=low
+
+  * debian/rules: Fixed a file conflict with libruby1.9 (Closes: #493309)
+
+ -- Daigo Moriwaki <daigo@debian.org>  Sun, 03 Aug 2008 21:32:36 +0900
+
+libgems-ruby (1.2.0-1) unstable; urgency=low
+
+  * New upstream release. (Closes: #487820)
+  * debian/control: Specified a minimum version of ruby1.9 because the 
+    rubygems package was merged.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Thu, 26 Jun 2008 23:10:40 +0900
+
+libgems-ruby (1.1.1-2) experimental; urgency=low
+
+  * The rubygems and libgems-ruby1.8 packages are now deprecated and merged
+    into a new rubygems1.8 package. In addition, this source also provides 
+    rubygems1.9. 
+
+ -- Daigo Moriwaki <daigo@debian.org>  Sun, 08 Jun 2008 22:31:57 +0900
+
+libgems-ruby (1.1.1-1) unstable; urgency=low
+
+  * New upstream release.
+  * No "instaling" (typo) found. Fixed by the upstream. (Closes: #443135)
+  * debian/patches/01_default_gem_path.dpatch: install executables to
+    /var/lib/gems/1.8/bin. (Closes: #458987, #480250)
+  * debian/control: 'rubygems' package now Suggests ruby1.8-dev and
+    build-essential since some gems may require native build. 
+    (Closes: #466189)
+  * gem now respects --http-proxy. Fixed by the upstream. (Closes: #414703)
+
+ -- Daigo Moriwaki <daigo@debian.org>  Sat, 10 May 2008 16:28:31 +0900
+
+libgems-ruby (1.0.1-4) unstable; urgency=low
+
+  * debian/etc/bash_completion.d/gem1.8: The completion did not work
+    because of a wrong function name. This issue has been fixed. 
+    Thanks to Victor Serbin.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Thu, 27 Dec 2007 23:46:36 +0900
+
+libgems-ruby (1.0.1-3) unstable; urgency=low
+
+  * BTS numbers to be closed were wrong at 1.0.0-1.
+    (Closes: #457065, #457180)
+
+ -- Daigo Moriwaki <daigo@debian.org>  Thu, 27 Dec 2007 23:31:56 +0900
+
+libgems-ruby (1.0.1-2) unstable; urgency=low
+
+  * debian/postrm: Only the /var/lib/gems/1.8 directory should be removed.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Thu, 27 Dec 2007 23:19:00 +0900
+
+libgems-ruby (1.0.1-1) unstable; urgency=low
+
+  * New upstream release.
+  * debian/control: depends rdoc1.8 instead of rake. Explicitly use 
+    rdoc1.8 to generate documentations because rake depends on RubyGems.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Tue, 25 Dec 2007 21:04:14 +0900
+
+libgems-ruby (1.0.0-1) unstable; urgency=low
+
+  [ Daigo Moriwaki ]
+  * New upstream release (Closes: #45706, #45718, #443135).
+  * Removed patches since the upstream has resolved the issues
+    - debian/patches/03_config_file.dpatch
+    - debian/patches/04_gem_runner.dpatch
+    - debian/patches/06_dependency_list.dpatch
+    - debian/patches/07_security.dpatch
+    - debian/patches/10_datadir.dpatch
+  * Replaced patches with a new and upstream-friendly way.
+    Thanks to James Healy <jimmy at deefa dot com>.
+    - Removed debian/patches/01_rubygems.dpatch
+    - Removed debian/patches/02_post-install.dpatch
+    - Added debian/patches/01_default_gem_path.dpatch
+  * Removed patches for --build-root command option, which is no longer 
+    supported.
+    - 05_gem_commands.dpatch
+    - 09_installer.dpatch 
+  * debian/patches/08_tighter_search_regex.dpatch: Followed the upstream 
+    changes. Thanks to James Healy.
+  * Added debian/patches/03_disable_update_system.dpatch: 
+    Disabled gem update --system (Closes: #452547).
+    Thanks to James Healy. 
+  * debian/patches/21_avoid_ioseek.dpatch: Added a description.
+  * Added debian/etc/bash_completion.d/gem1.8 instead of patching
+    by debian/patches/22_add_bash_completion.dpatch 
+    - Improved a description. Thanks to James Healy.
+    - Followed new options. 
+      Thanks to Victor Serbin <chepel at hotmail dot com>.
+  * Removed man pages and corrected debian/rules since the commands 
+    are gone.
+    - debian/gem_mirror.1
+    - debian/gem_server.sgml
+    - debian/gemlock.1, 
+    - debian/gemri.1
+    - debian/gemwhich.sgml
+    - debian/index_gem_repository.1
+  * debian/libgems-ruby1.8.docs: Included 'html/' (instead of 'docs/') 
+    where documents are correctly generated. 'Releases' is no longer 
+    provided.
+  * Added debian/rubygems.manpages. Thanks to James Healy.
+  * debian/control:
+    - Added rake in Build-Depends-Indep to generate documentations.
+    - Removed unnecessary docbook-to-man from Build-Depends-Indep.
+    - Bumped Standards-Version to 3.7.3.
+  * Added debian/prerm and debian/postrm: /usr/bin/gem and gem1.8 are 
+    now managed by Debian alternatives system.
+
+  [ Arnaud Cornet ]
+  * Use new Homepage dpkg header.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Thu, 20 Dec 2007 20:03:53 +0900
+
+libgems-ruby (0.9.4-4) unstable; urgency=low
+
+  * debian/patches/22_add_bash_completion.dpatch: imported Ubuntu's work.
+    It enables bash completion for the gem command.
+    Thanks to Ubuntu MOTU Developers.
+  * move debian/README.Debian to debian/rubygems.README.Debian.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Sun, 05 Aug 2007 09:53:12 +0900
+
+libgems-ruby (0.9.4-3) unstable; urgency=low
+
+  * debian/control: Replace deprecated ${Source-Version} with
+    ${source:Version}. Thanks to Paul van Tilburg.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Wed, 01 Aug 2007 12:47:21 +0900
+
+libgems-ruby (0.9.4-2) unstable; urgency=low
+
+  * debian/control: The rubygems package depends on the libgems-ruby package
+    having a particuler version same as source's. (Closes: #434167)
+
+ -- Daigo Moriwaki <daigo@debian.org>  Wed, 01 Aug 2007 12:31:05 +0900
+
+libgems-ruby (0.9.4-1) unstable; urgency=low
+
+  * New upstream release. (Closes: #426190)
+  * Removed dummy entries in this changelog.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Sun, 27 May 2007 16:17:35 +0900
+
+libgems-ruby (0.9.3-1) unstable; urgency=low
+
+  * New upstream release. (Closes: #407576)
+  * Stopped using the "Uploaders rule".
+  * debian/control
+    - Bumped up Standards-Version to 3.7.2.
+    - The rubygems package now depends on ruby1.8 instead of ruby because
+      shebangs in scripts are /usr/bin/ruby1.8.
+    - Description 'Homepage:' should preceed 2 spaces. (Closes: #415221)
+  * The upstream's URL has been changed. (Closes: #413251)
+  * The shebang of /usr/bin/gem is now "#!/usr/bin/ruby1.8" instead of
+    "#!/usr/bin/env ruby". (Closes: #416775)
+  * CVE-2007-0469: RubyGems did not check installation paths for gems
+    before writing files. (Closes: #408299)
+
+ -- Daigo Moriwaki <daigo@debian.org>  Sun, 27 May 2007 11:03:02 +0900
+
+libgems-ruby (0.9.0-6) unstable; urgency=low
+
+  * Installing gems on s390 did not work because of an IO.seek trouble.
+    Add a patch (debian/patches/21_avoid_ioseek.dpatch) for a workaround.
+    (Closes: #406388)
+
+ -- Daigo Moriwaki <daigo@debian.org>  Mon, 15 Jan 2007 20:36:33 +0900
+
+libgems-ruby (0.9.0-5) unstable; urgency=medium
+
+  * Nothing is changed but uploading to the unstable distribtion. In order to
+    make it into Etch's freeze, the urgency is bumped up.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Fri, 13 Oct 2006 12:41:29 +0900
+
+libgems-ruby (0.9.0-4) experimental; urgency=low
+
+  * Fixed the watch-file again (typo in group_id). Thanks to Paul van Tilburg.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Wed, 13 Sep 2006 12:39:31 +0900
+
+libgems-ruby (0.9.0-3) experimental; urgency=low
+
+  * Fixed the watch-file. Thanks to Paul van Tilburg.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Mon, 11 Sep 2006 22:57:20 +0900
+
+libgems-ruby (0.9.0-2) experimental; urgency=low
+
+  * Apply a patch of Marcus Rueckert for the --build-root option of the gem
+    command where the files are to be installed.
+    http://rubyforge.org/pipermail/rubygems-developers/2006-June/002010.html
+
+ -- Daigo Moriwaki <daigo@debian.org>  Sat, 16 Jul 2006 15:57:00 +0900
+
+libgems-ruby (0.9.0-1) experimental; urgency=low
+
+  * New upstream release.
+  * debian/generate_yaml_index.sgml was removed because the upstream deleted
+    the command.
+  * Write man pages for gem, gemlock, gemri, index_gem_repository and
+    gem_mirror.
+  * Add a patch (debian/patches/10_datadir.dpatch) which removes the
+    unnecessary shebang.  
+
+ -- Daigo Moriwaki <daigo@debian.org>  Fri,  7 Jul 2006 15:25:30 +0900
+
+libgems-ruby (0.8.11-4) experimental; urgency=low
+
+  * Add ruby1.8-dev to the recommends as users may build gem native
+    extensions.  (Closes: #373843)
+  * Move Build-Depends-Indep to Build-Depends as per policy section 7.6.
+  * Put Standards-Version to the latest version, 3.7.2.
+  * Put the debhelper version that is depended on to 5.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Fri, 16 Jun 2006 23:35:03 +0900
+
+libgems-ruby (0.8.11-3) experimental; urgency=low
+
+  * This package is now managed under pkg-ruby-extras
+    https://alioth.debian.org/projects/pkg-ruby-extras/.
+  * Add debian/control.in, which generates debian/control.
+  * debian/patches/01_rubygems.dpatch: Fix a bug. GEM_HOME is now available to
+    specify where gems are to be installed.
+
+ -- Daigo Moriwaki <daigo@debian.org>  Wed, 26 Apr 2006 23:49:18 +0900
+
+libgems-ruby (0.8.11-2) experimental; urgency=low
+
+  * debian/patches/08_tighter_search_regex.dpatch: new. fix a bug where the
+    regular expression in the local gem searching code was not using the ^ and
+    $ anchors on the gem name given on the command line, resulting in failures
+    when another gem then the specified has a substring match.  (Blair Zajac
+    <blair@orcaware.com>)
+
+  * debian/patches/09_installer.dpatch: new. fix a issue where executables
+    of installed gems were not uninstalled.
+
+ -- Daigo Moriwaki <beatles@sgtpepper.net>  Thu,  3 Nov 2005 14:54:00 +0900
+
+libgems-ruby (0.8.11-1) experimental; urgency=low
+
+  * Initial Release [closes: #282429].
+
+ -- Daigo Moriwaki <beatles@sgtpepper.net>  Sat, 10 Sep 2005 23:48:29 +0900
--- libgems-ruby-1.3.4.orig/debian/rubygems1.8.prerm
+++ libgems-ruby-1.3.4/debian/rubygems1.8.prerm
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+
+set -e
+
+case "$1" in
+    remove|deconfigure)
+        update-alternatives --quiet --remove gem /usr/bin/gem1.8
+        ;;
+    *)
+esac
+
+#DEBHELPER#
+
+exit 0
--- libgems-ruby-1.3.4.orig/debian/watch
+++ libgems-ruby-1.3.4/debian/watch
@@ -0,0 +1,6 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# 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	
--- libgems-ruby-1.3.4.orig/debian/rubygems1.9.postrm
+++ libgems-ruby-1.3.4/debian/rubygems1.9.postrm
@@ -0,0 +1,41 @@
+#! /bin/sh
+# postrm script for #PACKAGE#
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    purge)
+        rm -rf /var/lib/gems/1.9.0
+        ;;
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+
+
+        ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--- libgems-ruby-1.3.4.orig/debian/rubygems1.8.postrm
+++ libgems-ruby-1.3.4/debian/rubygems1.8.postrm
@@ -0,0 +1,41 @@
+#! /bin/sh
+# postrm script for #PACKAGE#
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    purge)
+        rm -rf /var/lib/gems/1.8
+        ;;
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+
+
+        ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--- libgems-ruby-1.3.4.orig/debian/patches/08_tighter_search_regex.dpatch
+++ libgems-ruby-1.3.4/debian/patches/08_tighter_search_regex.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 08_tighter_search_regex.dpatch by Daigo Moriwaki <daigo@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Included at 0.8.11-2
+
+@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
--- libgems-ruby-1.3.4.orig/debian/patches/00list
+++ libgems-ruby-1.3.4/debian/patches/00list
@@ -0,0 +1,5 @@
+01_default_gem_path.dpatch
+03_disable_update_system.dpatch
+08_tighter_search_regex.dpatch
+#05_gem_commands.dpatch
+#09_installer.dpatch 
--- libgems-ruby-1.3.4.orig/debian/patches/01_default_gem_path.dpatch
+++ libgems-ruby-1.3.4/debian/patches/01_default_gem_path.dpatch
@@ -0,0 +1,54 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_default_gem_path.dpatch by James Healy <jimmy@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}
+
+@DPATCH@
+diff -urNad trunk~/lib/rubygems/defaults.rb trunk/lib/rubygems/defaults.rb
+--- trunk~/lib/rubygems/defaults.rb	2009-05-21 08:30:35.000000000 +0900
++++ trunk/lib/rubygems/defaults.rb	2009-06-14 17:39:17.000000000 +0900
+@@ -15,19 +15,15 @@
+   ##
+   # 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]
+-    # 1.9.2dev reverted to 1.8 style path
+-    elsif RUBY_VERSION > '1.9' and RUBY_VERSION < '1.9.2' then
+-      File.join(ConfigMap[:libdir], ConfigMap[:ruby_install_name], 'gems',
+-                ConfigMap[:ruby_version])
+-    else
+-      File.join(ConfigMap[:libdir], ruby_engine, 'gems',
+-                ConfigMap[:ruby_version])
+-    end
++    File.join('/', 'var', 'lib', 'gems', ConfigMap[:ruby_version])
+   end
+ 
+   ##
+@@ -65,13 +61,11 @@
+ 
+   ##
+   # 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
+ 
+   ##
--- libgems-ruby-1.3.4.orig/debian/patches/03_disable_update_system.dpatch
+++ libgems-ruby-1.3.4/debian/patches/03_disable_update_system.dpatch
@@ -0,0 +1,30 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03_disable_update_system.dpatch by James Healy <jimmy@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
+
+@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-10-11 06:24:10.000000000 +0900
++++ trunk/lib/rubygems/commands/update_command.rb	2008-11-19 09:15:18.000000000 +0900
+@@ -48,18 +48,7 @@
+     hig = {}
+ 
+     if options[:system] then
+-      say "Updating RubyGems"
+-
+-      unless options[:args].empty? then
+-        fail "No gem names are allowed with the --system option"
+-      end
+-
+-      rubygems_update = Gem::Specification.new
+-      rubygems_update.name = 'rubygems-update'
+-      rubygems_update.version = Gem::Version.new Gem::RubyGemsVersion
+-      hig['rubygems-update'] = rubygems_update
+-
+-      options[:user_install] = false
++      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"
+ 
--- libgems-ruby-1.3.4.orig/debian/patches/09_installer.dpatch
+++ libgems-ruby-1.3.4/debian/patches/09_installer.dpatch
@@ -0,0 +1,60 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 09_installer.dpatch by Daigo Moriwaki <daigo@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@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
--- libgems-ruby-1.3.4.orig/debian/patches/05_gem_commands.dpatch
+++ libgems-ruby-1.3.4/debian/patches/05_gem_commands.dpatch
@@ -0,0 +1,28 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 05_gem_commands.dpatch by  <daigo@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
+
+@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|
--- libgems-ruby-1.3.4.orig/debian/etc/bash_completion.d/gem.in
+++ libgems-ruby-1.3.4/debian/etc/bash_completion.d/gem.in
@@ -0,0 +1,297 @@
+# Michael Schuerig, michael@schuerig.de, 2007-02-24
+# [2007-12-21] Updated by Victor Serbin (chepel@hotmail.com) for gem@@VERSION@@ v1.0
+# Free for all uses.
+
+have gem@@VERSION@@ &&
+_gem@@DOTLESS_VERSION@@()
+{
+    local cur prev completions
+
+    COMPREPLY=()
+    cur=${COMP_WORDS[COMP_CWORD]}
+    prev=${COMP_WORDS[COMP_CWORD-1]}
+
+    COMMANDS='build cert check cleanup contents dependency\
+      environment fetch generate_index help install list\
+      lock mirror outdated pristine query rdoc search server\
+      sources specification uninstall unpack update which'
+
+    GEM_OPTIONS='\
+      -h --help\
+      -v --version'
+
+    COMMON_OPTIONS='\
+      -h --help\
+      -V --verbose --no-verbose\
+      -q --quiet\
+      --config-file\
+      --backtrace\
+      --debug'
+
+    CERT_OPTIONS='\
+      -a -add\
+      -l --list\
+      -r --remove\
+      -b --build\
+      -C --certificate\
+      -K --private-key\
+      -s --sign'
+
+    CHECK_OPTIONS='\
+      --verify\
+      -a --alien\
+      -t --test\
+      -v --version'
+
+    CLEANUP_OPTIONS='\
+      -d --dry-run'
+
+    CONTENTS_OPTIONS='\
+      -v --version\
+      -s --spec-dir\
+      -l --lib-only --no-lib-only'
+
+    DEPENDENCY_OPTIONS='\
+      -v --version\
+      --platform\
+      -R --reverse-dependencies --no-reverse-dependencies\
+      -p --pipe'
+
+    ENVIRONMENT_OPTIONS=''
+
+    FETCH_OPTIONS='\
+      -v --version\
+      --platform\
+      -B --bulk-threshold\
+      -p --http-proxy --no-http-proxy\
+      --source'
+
+    GENERATE_INDEX_OPTIONS='\
+      -d --directory'
+
+    HELP_OPTIONS=$COMMANDS
+
+    INSTALL_OPTIONS='\
+      --platform\
+      -v --version\
+      -i --install-dir\
+      -d --rdoc --no-rdoc\
+      --ri --no-ri\
+      -E --env-shebang\
+      -f --force --no-force\
+      -t --test --no-test\
+      -w --wrappers --no-wrappers\
+      -P --trust-policy\
+      --ignore-dependencies\
+      -y --include-dependencies\
+      --format-executable --no-format-executable\
+      -l --local\
+      -r --remote\
+      -b --both\
+      -B --bulk-threshold\
+      --source\
+      -p --http-proxy --no-http-proxy\
+      -u --update-sources --no-update-sources'
+
+    LIST_OPTIONS='\
+      -d --details --no-details\
+      --versions --no-versions\
+      -l --local\
+      -r --remote\
+      -b --both\
+      -B --bulk-threshold\
+      --source\
+      -p --http-proxy --no-http-proxy\
+      -u --update-sources --no-update-sources'
+
+    LOCK_OPTIONS='\
+      -s --strict --no-strict'
+
+    MIRROR_OPTIONS=''
+
+    OUTDATED_OPTIONS='\
+      --platform'
+
+    PRISTINE_OPTIONS='\
+      --all\
+      -v --version'
+
+    QUERY_OPTIONS='\
+      -n --name-matches\
+      -d --details --no-details\
+      --versions --no-versions\
+      -l --local\
+      -r --remote\
+      -b --both\
+      -B --bulk-threshold\
+      --source\
+      -p --http-proxy --no-http-proxy\
+      -u --update-sources --no-update-sources'
+
+    RDOC_OPTIONS='\
+      --all\
+      --rdoc --no-rdoc\
+      --ri --no-ri\
+      -v --version'
+
+    SEARCH_OPTIONS='\
+      -d --details --no-details\
+      --versions --no-versions\
+      -l --local\
+      -r --remote\
+      -b --both\
+      -B --bulk-threshold\
+      --source\
+      -p --http-proxy --no-http-proxy\
+      -u --update-sources --no-update-sources'
+
+    SERVER_OPTIONS='\
+      -p --port\
+      -d --dir\
+      --daemon --no-daemon'
+
+    SOURCES_OPTIONS='\
+      -a --add\
+      -l --list\
+      -r --remove\
+      -u --update\
+      -c --clear-all'
+
+    SPECIFICATION_OPTIONS='\
+      -v --version\
+      --platform\
+      --all\
+      -l --local\
+      -r --remote\
+      -b --both\
+      -B --bulk-threshold\
+      --source\
+      -p --http-proxy --no-http-proxy\
+      -u --update-sources --no-update-sources'
+
+    UNINSTALL_OPTIONS='\
+      -a --all --no-all\
+      -i --ignore-dependencies --no-ignore-dependencies\
+      -x --executables --no-executables\
+      -v --version\
+      --platform'
+
+    UNPACK_OPTIONS='\
+      --target\
+      -v --version'
+
+    UPDATE_OPTIONS='\
+      --system\
+      --platform\
+      -i --install-dir\
+      -d --rdoc --no-rdoc\
+      --ri --no-ri\
+      -E --env-shebang\
+      -f --force --no-force\
+      -t --test --no-test\
+      -w --wrappers --no-wrappers\
+      -P --trust-policy\
+      --ignore-dependencies\
+      -y --include-dependencies\
+      --format-executable --no-format-executable\
+      -l --local\
+      -r --remote\
+      -b --both\
+      -B --bulk-threshold\
+      --source\
+      -p --http-proxy --no-http-proxy\
+      -u --update-sources --no-update-sources'
+
+    WHICH_OPTIONS='\
+      -a --all --no-all\
+      -g --gems-first --no-gems-first'
+
+    case "${prev}" in
+      build)
+        completions="$COMMON_OPTIONS $BUILD_OPTIONS"
+        ;;
+      cert)
+        completions="$COMMON_OPTIONS $CERT_OPTIONS"
+        ;;
+      check)
+        completions="$COMMON_OPTIONS $CHECK_OPTIONS"
+        ;;
+      cleanup)
+        completions="$COMMON_OPTIONS $CLEANUP_OPTIONS"
+        ;;
+      contents)
+        completions="$COMMON_OPTIONS $CONTENTS_OPTIONS"
+        ;;
+      dependency)
+        completions="$COMMON_OPTIONS $DEPENDENCY_OPTIONS"
+        ;;
+      environment)
+        completions="$COMMON_OPTIONS $ENVIRONMENT_OPTIONS"
+        ;;
+      fetch)
+        completions="$COMMON_OPTIONS $FETCH_OPTIONS"
+        ;;
+      generate_index)
+        completions="$COMMON_OPTIONS $GENERATE_INDEX_OPTIONS"
+        ;;
+      help)
+        completions="$COMMON_OPTIONS $HELP_OPTIONS"
+        ;;
+      install)
+        completions="$COMMON_OPTIONS $INSTALL_OPTIONS"
+        ;;
+      list)
+        completions="$COMMON_OPTIONS $LIST_OPTIONS"
+        ;;
+      lock)
+        completions="$COMMON_OPTIONS $LOCK_OPTIONS"
+        ;;
+      mirror)
+        completions="$COMMON_OPTIONS $MIRROR_OPTIONS"
+        ;;
+      outdated)
+        completions="$COMMON_OPTIONS $OUTDATED_OPTIONS"
+        ;;
+      pristine)
+        completions="$COMMON_OPTIONS $PRISTINE_OPTIONS"
+        ;;
+      query)
+        completions="$COMMON_OPTIONS $QUERY_OPTIONS"
+        ;;
+      rdoc)
+        completions="$COMMON_OPTIONS $RDOC_OPTIONS"
+        ;;
+      search)
+        completions="$COMMON_OPTIONS $SEARCH_OPTIONS"
+        ;;
+      server)
+        completions="$COMMON_OPTIONS $SERVER_OPTIONS"
+        ;;
+      sources)
+        completions="$COMMON_OPTIONS $SOURCES_OPTIONS"
+        ;;
+      specification)
+        completions="$COMMON_OPTIONS $SPECIFICATION_OPTIONS"
+        ;;
+      uninstall)
+        completions="$COMMON_OPTIONS $UNINSTALL_OPTIONS"
+        ;;
+      unpack)
+        completions="$COMMON_OPTIONS $UNPACK_OPTIONS"
+        ;;
+      update)
+        completions="$COMMON_OPTIONS $UPDATE_OPTIONS"
+        ;;
+      which)
+        completions="$COMMON_OPTIONS $WHICH_OPTIONS"
+        ;;
+      *)
+        completions="$COMMANDS $GEM_OPTIONS"
+        ;;
+    esac
+
+    COMPREPLY=( $( compgen -W "$completions" -- $cur ))
+    return 0
+}
+
+[ -n "${have:-}" ] && complete -F _gem@@DOTLESS_VERSION@@ $filenames gem@@VERSION@@
