Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I package a Ruby application for Ubuntu, including its gem dependencies?

I have a command-line utility called Maid that I currently distribute as a RubyGem. I'd also like to distribute it as a .deb package to make it easier for Ubuntu users to install.

Right now, Ubuntu users have to do quite a bit manually, especially for someone unfamiliar with Ruby:

sudo apt-get install ruby
sudo apt-get install rubygems
# Make sure `ruby` and `gem` are in `$PATH`
sudo gem install maid
maid version # example command

Ideally, I want a single command to install on a fresh Ubuntu installation:

sudo apt-get install maid
maid version # example command

The suite of gem2deb tools (gem2tgz, dh-make-ruby, etc.) are almost what I'm looking for. But by default gem2deb doesn't package any of the gem dependencies that are required. Maid is really simple and only depends on thor at runtime. (Edit: as Maid has evolved, and now has more dependencies.) But without that dependency, nothing works.

So, how do I package this Ruby application for Ubuntu and also include its gem dependencies? Are there any other tools I could use or tutorials/examples I could follow?

like image 902
Benjamin Oakes Avatar asked Sep 02 '12 04:09

Benjamin Oakes


1 Answers

Because apt-get and gem are both dependency resolving, you can just make a meta package that depends on ruby1.9.1 (which itself brings in Rubygems and everything else). Then in the post-install script, just do a sudo gem1.9.1 install maid.

I can't lay out the whole process of making a package here, but there are a lot of good tutorials on it around the web.

like image 149
Linuxios Avatar answered Sep 22 '22 00:09

Linuxios