Gem to rpm converter 0.6.0

Gem to rpm converter creates an RPM spec file from a Ruby gem.
Gem to rpm converter creates an RPM spec file from a Ruby gem. The project uses the gem metadata to fill out most of the information needed for building an RPM containing the gem.


Run 'gem2rpm --help' for options

At its simplest, download a gem (let's call that file GEM) and run

gem2rpm $GEM

This will print an rpm spec file based on the information contained in the gem's spec file. In general, it is necessary to edit the generated spec file because the gem is missing some important information that is customarily provided in rpm's, most notably the license and the changelog.

Rather than editing the generated specfile, edit the template from which the specfile is generated. This will make it easier to update the RPM when a new version of the Gem becomes available.

To support this process, it is recommended to first save the default template somewhere:

gem2rpm -T > rubygem-GEM.spec.template

Now, edit the template and then run gem2rpm to generate the spec file using the edited template:

gem2rpm -t rubygem-GEM.spec.template > rubygem-GEM.spec

With that, you can now build your RPM as ususal. When a new version of the gem becomes available, you should edit the saved template and rerun gem2rpm over it.

Template Details:

The template is a standard erb file; there are three main variables available in the template file:

format - The Gem::Format for the gem
spec - The Gem::Specification for the gem (the same as format.spec)


A typical source RPM for a gem should consist of three files: the gem file itself, the template for the spec file and the spec file. To ensure that the template will be included in the source RPM, it must be listed as one of the sources in the spec file.

The resulting rpms should follow the naming convention 'rubygem-$GEM' where GEM is the name of the packaged gem. The default template also makes sure that the resulting package provides 'ruby($GEM)', according to general packaging conventions for scripting languages.

last updated on:
October 7th, 2008, 11:54 GMT
license type:
GPL (GNU General Public License) 
developed by:
David Lutterkort
ROOT \ System \ Software Distribution
Gem to rpm converter
Download Button

In a hurry? Add it to your Download Basket!

user rating 22



Rate it!
What's New in This Release:
  • This release works with newer (post 1.0.0) versions of rubygems.
read full changelog

Add your review!