From: Jim Freeze Date: 2005-03-04T14:57:11+09:00 Subject: Re: ruby gems, and the require problem (was Re: RAA Status & b) * Sam Roberts [2005-03-04 14:37:28 +0900]: > MY CODE. IT'S MY CODE. Argh. > > I wrote the script, I put it in the package, and I have to make two > versions of it, one assuming that my package was installed with ruby > gems in default mode, the other assuming ruby gems wasn't used or that > the user did "gem deploy". If I understand correctly, you shouldn't have to make to versions of a script that is in a library. The person writing code calling your lib needs to be careful (see below), but your library (ie code in your package) shouldn't have to be conscious that it is a gem or not. > gems has created two distinct dialects of ruby, one uses ruby's require, > and the other uses the gems require, of the same name. Code written in > ruby's dialect won't work with gems without hacking the code, or hacking > the environment. > > Code written with the require_gems won't work for people who don't have > gems, even if they have the libraries. Is it really that much trouble to write: begin require 'some-lib' rescue LoadError require 'rubygems' require 'some-lib' end Maybe we could get this added to the std distro, assuming the gems ships with the std distro. -- Jim Freeze Code Red. Code Ruby