views:

51

answers:

2

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?

+2  A: 

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.

August Lilleaas
But will this also install the necessary non-gem packages like sqlite3?
ulver
+1  A: 

If you are requiring activerecord, you need some sort of activerecord adapter driver installed or the gem corresponding to the db, e.g. pg, mysql, sqlite-ruby as well as a connection set up to connect to said db.

Whenever you install gems using the current rubygems they will install dependencies, its just that activerecord is a bit ... "funny" ?

Omar Qureshi