From: James Britt Date: 2004-07-30T08:04:25+09:00 Subject: Re: Including other people's Ruby libs in your package Jamis Buck wrote: > James Britt wrote: > >> Aredridel wrote: >> >>> >>> Speaking as a packager, don't. Just document, clearly, the dependencies >>> and where to get them. >>> It's annoying to have to patch away the extra cruft when packaging a >>> package for distribution with a linux distro -- but that's the job -- >>> make it as light as possible with all the features. >> >> >> >> I've considered this, but find it potentially too annoying to the user. >> >> I would prefer that people be able to just download a tarball, extract >> it, and copy over a directory to the libs dir. And it just works. > > > On the other hand, it can be very annoying for a user as well when they > already have a *newer* version of that same dependency installed, and > then they install your library and suddenly things break. That's right. So let's don't do that. :) That question is, What's the best way? One approach is change $: to look in some specified directory, as a last resort, if the standard path does not turn up the needed lib. So, for example, if BlueCLoth is already installed, then the pre-packaged copy is never loaded because a "correctly" installed version has been found. If my lib is installed in /foo/bar and my class file does $:.push "/foo/bar/dependencies" # or something along those lines then my special directory should be the last place Ruby looks for a file. Or no? > > If nothing else, provide two versions of your package: one *with* > dependencies, and one without. I'm in the camp that prefers applications > NOT be shipped with their dependencies included, but I can understand > that others may prefer the other way. > > The moral of the story is that there isn't a perfect solution to this, > unfortunately. :( Rubygems' dependency feature comes close, though. > For Gems, it might be nice (or feature-creep overkill) to specify that, if a user refuses to install dependency Foo, then fail the installation, but if they refuse pseudo-dependency Bar, that's OK, keep going with a "You're going to miss some good stuff" warning.