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

I have a Maid command-line utility that I am distributing as RubyGem now . I would also like to distribute it as a .deb package to make installation easier for Ubuntu users .

Ubuntu users currently have to do very little by hand, especially for someone new to 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 one separate command to be installed on a new Ubuntu installation:

 sudo apt-get install maid maid version # example command 

The gem2deb ( gem2tgz , dh-make-ruby , etc.) is almost what I'm looking for. But by default, gem2deb does not pack any of the required gem dependencies. Virgo is really simple and depends only on thor at runtime. ( Edit: because the maiden has changed and now has more dependencies.) But without this dependency, nothing works.

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

+6
source share
2 answers

Since apt-get and gem are both resolving dependencies, you can simply create a meta package that depends on ruby1.9.1 (which itself contributes to Rubygems and everything else). Then in the post-install script just run sudo gem1.9.1 install maid .

I can not put the whole process of creating a package here, but it has a lot of good tutorials on the Internet.

+2
source

Using fpm , you can (among other things) directly create gems debate. wiki has an extensive example. Its essence is to call

 cd /tmp fpm -s gem -t deb maid 
+1
source

Source: https://habr.com/ru/post/924376/


All Articles