[Rubygems-developers] gem list as input to gem install?

Hugh Sasse hgs at dmu.ac.uk
Mon Feb 1 11:45:42 EST 2010

I was thinking about how to solve the problem of rebuilding a
collection of gems to match those installed on a system.  For
example, when upgrading a system when binary compatibility is broken,
it would be useful to be able to preserve the list of
installed gems to rebuild it afterwards.  Another use case would be
in trying to replicate errors on a system which may be due to the
actual gems installed and compatibility issues between them.  The exact
collection of gems could be reported in such a way that Rubygems can
use it to perform the installation.

My idea is that a command, let's call it report for now, would do 
the same as gem list --local but instead of producing output in the

RubyInline (3.8.4, 3.8.1, 3.6.6, 3.6.3, 3.6.2)
s4t-utils (1.0.4)
sexp_processor (3.0.3, 3.0.1)

it would produce output in the form

gem install -v 3.8.4 RubyInline
gem install -v 3.8.1 RubyInline
gem install -v 3.8.6 RubyInline
gem install -v 3.6.3 RubyInline
gem install -v 3.6.2 RubyInline
gem install -v 1.0.4 s4t-utils
gem install -v 3.0.3 sexp_processor
gem install -v 3.0.1 sexp_processor

This could then be fed into a script on the new setup so that the old
collection of gems would get created correctly.

I think this could be achieved by refactoring gem's list command so that
the displaying is separate from the gathering of the data.  Then a
different command would be able to format the information in the above

Would a patch to do this be welcome, or is there a good reason not to do
this?  Is there anything else I have missed?

        Thank you,

More information about the Rubygems-developers mailing list