On Thu, Jan 15, 2009 at 12:17 AM, Chad Woolley <thewoolley...@gmail.com> wrote: > On Wed, Jan 14, 2009 at 10:08 PM, Jim Weirich <jim.weir...@gmail.com> wrote: >> Only use a 'gem' command if you want something other than the latest >> installed version of a gem. You application should arrange to invoke the >> gem command early in the program, after 'rubygems' has been required, but >> before any other requires have run. > > We use GemInstaller's 'autogem' function to accomplish this via > /config/preinitializer.rb in all our Rails apps: > http://geminstaller.rubyforge.org/documentation/tutorials.html#using_the_autogem_option_to_automatically_require_gems > > This works very well for us, and I believe Rails' config.gems can do > the same thing (except for Rails itself, would cause the universe to > implode)
Some of this might be helped if RubyGems provided a "default require" piece of metadata that could be queried about a gem. One of the complaints that I've heard—and don't really have a fix for—is that the names of gems and what you require are different. When I was working on PDF::Writer, for example, it was: gem 'pdf-writer', '=1.1.8' require 'pdf/writer' Now, those two are close enough, but it wasn't "require 'pdf-writer'", which is what some people apparently expect. (I'm not sure why; maybe it was the early autorequire.) If we had a way of querying a gem for it's "full require" or "default require", it might help at least with exploration of a gem. One way that we could do this is to make it so that the "gem" command returns a read-only copy of the spec: pdf_writer = gem 'pdf-writer', '=1.1.8' require pdf_writer.default_require Or something like that. -austin -- Austin Ziegler * halosta...@gmail.com * http://www.halostatue.ca/ * aus...@halostatue.ca * http://www.halostatue.ca/feed/ * aus...@zieglers.ca _______________________________________________ Rubygems-developers mailing list Rubygems-developers@rubyforge.org http://rubyforge.org/mailman/listinfo/rubygems-developers