Skip to content
Jordan Sissel edited this page Jan 21, 2011 · 8 revisions

Converting rubygems

Simplest possible invocation:

% cd /tmp
% fpm -s gem -t deb json
...
Created /tmp/rubygem-json-1.4.6-1.amd64.deb

This will download the latest 'json' rubygem from rubygems.org and convert it to a .deb. It will create a package named 'rubygem-json-VERSION_ARCH.deb' with appropriate version/arch in place.

Check the package:

% dpkg --info rubygem-json-1.4.6-1.amd64.deb 
 new debian package, version 2.0.
 size 1004040 bytes: control archive= 335 bytes.
     275 bytes,    10 lines      control              
       5 bytes,     1 lines      md5sums              
 Package: rubygem-json
 Version: 1.4.6-1
 Architecture: amd64
 Maintainer: Florian Frank
 Standards-Version: 3.9.1
 Section: Languages/Development/Ruby 
 Priority: extra
 Homepage: http://flori.github.com/json
 Description: JSON Implementation for Ruby
   JSON Implementation for Ruby

From the above, you can see that fpm automatically picked the package name, version, maintainer, section, homepage, and description all from the rubygem itself. Nothing for you to worry about :)

Simple example with version and auto-dependencies

You can ask for a specific version with '-v '. It will also handle dependencies. How about an older gem like rails 2.2.2?

% fpm -s gem -t deb -v 2.2.2 rails
Trying to download rails (version=2.2.2)
...
Created .../rubygem-rails-2.2.2-1.amd64.deb

Now observe the package created:

% dpkg --info ./rubygem-rails-2.2.2-1.amd64.deb
 new debian package, version 2.0.
 size 2452008 bytes: control archive= 445 bytes.
     575 bytes,    11 lines      control              
       6 bytes,     1 lines      md5sums              
 Package: rubygem-rails
 Version: 2.2.2-1
 Architecture: amd64
 Maintainer: David Heinemeier Hansson
 Depends: rubygem-rake (>= 0.8.3), rubygem-activesupport (= 2.2.2), rubygem-activerecord (= 2.2.2), rubygem-actionpack (= 2.2.2), rubygem-actionmailer (= 2.2.2), rubygem-activeresource (= 2.2.2)
 Standards-Version: 3.9.1
 Section: Languages/Development/Ruby 
 Priority: extra
 Homepage: http://www.rubyonrails.org
 Description: Web-application framework with template engine, control-flow layer, and ORM.
   Web-application framework with template engine, control-flow layer, and ORM.

What does the package install?

dpkg -c ./rubygem-rails-2.2.2-1.amd64.deb
...
drwxr-xr-x root/root         0 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/
drwxr-xr-x root/root         0 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
-rw-r--r-- root/root      3639 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/source_annotation_extractor.rb
-rw-r--r-- root/root       198 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/performance_test_help.rb
drwxr-xr-x root/root         0 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/
-rw-r--r-- root/root       204 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/log.rake
-rw-r--r-- root/root      2695 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/gems.rake
-rw-r--r-- root/root      4858 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/testing.rake
-rw-r--r-- root/root     17727 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake
Clone this wiki locally