Search code examples
rubylinuxrubygemsdistributionsoftware-distribution

Given a ruby script how to figure out what it depends on?


I want to distribute a ruby script to many of my friends, because it's useful. But how do I know what else they might have to install? I mean at the top of the script, there is this:

require 'rubygems'      #
require 'activerecord'  #TODO: figure out what packages this depends on
require 'activesupport' #
require 'duration'      #

That gives me some idea about what they need to install, but last time I tried it on a friend's computer(Linux) each of the above turned out to require move packages. For example, activesupport requires a database, which in case of this script is sqlite3, so I had to install sqlite3 and a bunch of lib and maybe even dev packages.

Is there any tool or method to gather up a list of all the dependencies so I can include them in installation instructions? Or even better, is there a way to package them into an easy installator?


Solution

  • Distribute it as a gem. The gem lets you add dependencies, and if a dependency has a dependency, the rubygems system will install it for you.