Update: see my recent post describing a better way to do this.
I often need to deploy Ruby gems across many CentOS servers. I prefer to use the native OS package management tools (rpm + yum) rather than using Ruby gems.
Here’s how to build RPMs from Ruby gems using gem2rpm.
I am assuming you have the necessary build tools installed (if not, yum install rpmdevtools) and have already created an RPM build environment, eg:
~/rpmbuild|-- BUILD|-- RPMS|-- SOURCES|-- SPECS`-- SRPMS
First, make sure gem2rpm is installed:
yum install rubygem-gem2rpmThen, grab the gem you want to convert to an RPM:
cd ~/rpmbuild/SOURCESgem fetch capistrano
This will dump the gem file in the current directory, in this case: capistrano-2.5.14.gem.
Next, create a spec file:
gem2rpm capistrano-2.5.14.gem > ../SPECS/rubygem-capistrano.spec
Finally, build the RPM(s):
rpmbuild -ba ../SPECS/rubygem-capistrano.spec
Comments